diff mbox series

[FFmpeg-devel] avformat/mov: Check for duplicate clli

Message ID 20210913210413.8429-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] avformat/mov: Check for duplicate clli
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Michael Niedermayer Sept. 13, 2021, 9:04 p.m. UTC
Fixes: memleak
Fixes: 35261/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4869656287510528

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(+)

Comments

James Almer Sept. 13, 2021, 9:07 p.m. UTC | #1
On 9/13/2021 6:04 PM, Michael Niedermayer wrote:
> Fixes: memleak
> Fixes: 35261/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4869656287510528
> 
> 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 c5583e07c79..343c0c0ee35 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -5485,6 +5485,9 @@ static int mov_read_clli(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>           return AVERROR_INVALIDDATA;
>       }
>   
> +    if (sc->coll)
> +        return AVERROR_INVALIDDATA;

mov_read_coll() ignores any duplicate box, after emitting a warning. 
Maybe the same should be done here.

> +
>       sc->coll = av_content_light_metadata_alloc(&sc->coll_size);
>       if (!sc->coll)
>           return AVERROR(ENOMEM);
>
Michael Niedermayer Sept. 14, 2021, 3:26 p.m. UTC | #2
On Mon, Sep 13, 2021 at 06:07:17PM -0300, James Almer wrote:
> On 9/13/2021 6:04 PM, Michael Niedermayer wrote:
> > Fixes: memleak
> > Fixes: 35261/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4869656287510528
> > 
> > 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 c5583e07c79..343c0c0ee35 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -5485,6 +5485,9 @@ static int mov_read_clli(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> >           return AVERROR_INVALIDDATA;
> >       }
> > +    if (sc->coll)
> > +        return AVERROR_INVALIDDATA;
> 
> mov_read_coll() ignores any duplicate box, after emitting a warning. Maybe
> the same should be done here.

will apply with that change

[...]

thx
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index c5583e07c79..343c0c0ee35 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5485,6 +5485,9 @@  static int mov_read_clli(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         return AVERROR_INVALIDDATA;
     }
 
+    if (sc->coll)
+        return AVERROR_INVALIDDATA;
+
     sc->coll = av_content_light_metadata_alloc(&sc->coll_size);
     if (!sc->coll)
         return AVERROR(ENOMEM);