[FFmpeg-devel] [PATCH 1/6] avformat/mov: Check tile_item_list

Michael Niedermayer michael at niedermayer.cc
Sat Apr 27 21:06:12 EEST 2024


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 at 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

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240427/066b53ab/attachment.sig>


More information about the ffmpeg-devel mailing list