[FFmpeg-devel] [PATCH 2/2] avcodec/av1dec: Check tile_cols

James Almer jamrial at gmail.com
Mon Mar 21 23:03:12 EET 2022


On 2/1/2022 3:52 PM, Michael Niedermayer wrote:
> Fixes: division by zero
> Fixes: 43769/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5392562205097984
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>   libavcodec/av1dec.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
> index 62d459cded..581f22a849 100644
> --- a/libavcodec/av1dec.c
> +++ b/libavcodec/av1dec.c
> @@ -394,6 +394,9 @@ static int get_tiles_info(AVCodecContext *avctx, const AV1RawTileGroup *tile_gro
>       s->tg_start = tile_group->tg_start;
>       s->tg_end = tile_group->tg_end;
>   
> +    if (s->raw_frame_header->tile_cols == 0)

This should not happen. CBS should have returned an error instead or 
setting tile_cols to 0.
The bug should probably be fixed there.

> +        return AVERROR_INVALIDDATA;
> +
>       for (tile_num = tile_group->tg_start; tile_num <= tile_group->tg_end; tile_num++) {
>           tile_row = tile_num / s->raw_frame_header->tile_cols;
>           tile_col = tile_num % s->raw_frame_header->tile_cols;


More information about the ffmpeg-devel mailing list