Message ID | 20240426030839.3001504-1-michael@niedermayer.cc |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/6] avformat/mov: Check tile_item_list | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
On 4/26/2024 12:08 AM, Michael Niedermayer wrote: > Fixes: Null pointer dereference > Fixes: 67861/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5352628142800896 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavformat/mov.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index ecd29a7d08b..97a24e6737e 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -9289,6 +9289,9 @@ static int read_image_grid(AVFormatContext *s, const HEIFGrid *grid, > if (tile_grid->nb_tiles != size) > return AVERROR_INVALIDDATA; > > + for (int i = 0; i < size; i++) > + if (!grid->tile_item_list[i]) > + return AVERROR_INVALIDDATA; > for (int i = 0; i < tile_cols; i++) > tile_grid->coded_width += grid->tile_item_list[i]->width; > for (int i = 0; i < size; i += tile_cols) We shouldn't get this far if that's NULL. Does the following also work? > diff --git a/libavformat/mov.c b/libavformat/mov.c > index ecd29a7d08..b21c4b6f3c 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -9440,7 +9440,7 @@ static int mov_parse_tiles(AVFormatContext *s) > break; > } > > - if (k == grid->nb_tiles) { > + if (k == mov->nb_heif_item) { > av_log(s, AV_LOG_WARNING, "HEIF item id %d referenced by grid id %d doesn't " > "exist\n", > tile_id, grid->item->item_id);
On Fri, Apr 26, 2024 at 09:30:50AM -0300, James Almer wrote: > On 4/26/2024 12:08 AM, Michael Niedermayer wrote: > > Fixes: Null pointer dereference > > Fixes: 67861/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5352628142800896 > > > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > > --- > > libavformat/mov.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/libavformat/mov.c b/libavformat/mov.c > > index ecd29a7d08b..97a24e6737e 100644 > > --- a/libavformat/mov.c > > +++ b/libavformat/mov.c > > @@ -9289,6 +9289,9 @@ static int read_image_grid(AVFormatContext *s, const HEIFGrid *grid, > > if (tile_grid->nb_tiles != size) > > return AVERROR_INVALIDDATA; > > + for (int i = 0; i < size; i++) > > + if (!grid->tile_item_list[i]) > > + return AVERROR_INVALIDDATA; > > for (int i = 0; i < tile_cols; i++) > > tile_grid->coded_width += grid->tile_item_list[i]->width; > > for (int i = 0; i < size; i += tile_cols) > > We shouldn't get this far if that's NULL. Does the following also work? > > > diff --git a/libavformat/mov.c b/libavformat/mov.c > > index ecd29a7d08..b21c4b6f3c 100644 > > --- a/libavformat/mov.c > > +++ b/libavformat/mov.c > > @@ -9440,7 +9440,7 @@ static int mov_parse_tiles(AVFormatContext *s) > > break; > > } > > > > - if (k == grid->nb_tiles) { > > + if (k == mov->nb_heif_item) { works, please apply thx [...]
diff --git a/libavformat/mov.c b/libavformat/mov.c index ecd29a7d08b..97a24e6737e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -9289,6 +9289,9 @@ static int read_image_grid(AVFormatContext *s, const HEIFGrid *grid, if (tile_grid->nb_tiles != size) return AVERROR_INVALIDDATA; + for (int i = 0; i < size; i++) + if (!grid->tile_item_list[i]) + return AVERROR_INVALIDDATA; for (int i = 0; i < tile_cols; i++) tile_grid->coded_width += grid->tile_item_list[i]->width; for (int i = 0; i < size; i += tile_cols)
Fixes: Null pointer dereference Fixes: 67861/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5352628142800896 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavformat/mov.c | 3 +++ 1 file changed, 3 insertions(+)