[FFmpeg-devel,2/3] avcodec/pngdec: Check that previous_picture has same w/h/format

Submitted by Michael Niedermayer on July 11, 2019, 12:29 p.m.

Details

Message ID 20190711122918.20176-2-michael@niedermayer.cc
State Accepted
Commit 18c808ffbed81ea580fe6ddd6524dd7bea3f8d0e
Headers show

Commit Message

Michael Niedermayer July 11, 2019, 12:29 p.m.
Fixes: out of array access
Fixes: 15540/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5684905029140480

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/pngdec.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Paul B Mahol July 12, 2019, 8:30 a.m.
On 7/11/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: out of array access
> Fixes:
> 15540/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5684905029140480
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/pngdec.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> index 5209e342db..bf5a5191cc 100644
> --- a/libavcodec/pngdec.c
> +++ b/libavcodec/pngdec.c
> @@ -1391,6 +1391,9 @@ exit_loop:
>              if (CONFIG_PNG_DECODER && avctx->codec_id != AV_CODEC_ID_APNG)
>                  handle_p_frame_png(s, p);
>              else if (CONFIG_APNG_DECODER &&
> +                     s->previous_picture.f->width == p->width  &&
> +                     s->previous_picture.f->height== p->height &&
> +                     s->previous_picture.f->format== p->format &&
>                       avctx->codec_id == AV_CODEC_ID_APNG &&
>                       (ret = handle_p_frame_apng(avctx, s, p)) < 0)
>                  goto fail;
> --
> 2.22.0

Probably OK
Michael Niedermayer July 12, 2019, 6:49 p.m.
On Fri, Jul 12, 2019 at 10:30:26AM +0200, Paul B Mahol wrote:
> On 7/11/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > Fixes: out of array access
> > Fixes:
> > 15540/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-5684905029140480
> >
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/pngdec.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> > index 5209e342db..bf5a5191cc 100644
> > --- a/libavcodec/pngdec.c
> > +++ b/libavcodec/pngdec.c
> > @@ -1391,6 +1391,9 @@ exit_loop:
> >              if (CONFIG_PNG_DECODER && avctx->codec_id != AV_CODEC_ID_APNG)
> >                  handle_p_frame_png(s, p);
> >              else if (CONFIG_APNG_DECODER &&
> > +                     s->previous_picture.f->width == p->width  &&
> > +                     s->previous_picture.f->height== p->height &&
> > +                     s->previous_picture.f->format== p->format &&
> >                       avctx->codec_id == AV_CODEC_ID_APNG &&
> >                       (ret = handle_p_frame_apng(avctx, s, p)) < 0)
> >                  goto fail;
> > --
> > 2.22.0
> 
> Probably OK

will apply

thanks

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 5209e342db..bf5a5191cc 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1391,6 +1391,9 @@  exit_loop:
             if (CONFIG_PNG_DECODER && avctx->codec_id != AV_CODEC_ID_APNG)
                 handle_p_frame_png(s, p);
             else if (CONFIG_APNG_DECODER &&
+                     s->previous_picture.f->width == p->width  &&
+                     s->previous_picture.f->height== p->height &&
+                     s->previous_picture.f->format== p->format &&
                      avctx->codec_id == AV_CODEC_ID_APNG &&
                      (ret = handle_p_frame_apng(avctx, s, p)) < 0)
                 goto fail;