[FFmpeg-devel,5/7] avcodec/anm: Check input size for a frame with just a stop code

Submitted by Michael Niedermayer on Aug. 15, 2019, 9:49 p.m.

Details

Message ID 20190815214915.909-5-michael@niedermayer.cc
State Accepted
Commit 1965161ef6d2aac8d3b034570c3da69dabca9e71
Headers show

Commit Message

Michael Niedermayer Aug. 15, 2019, 9:49 p.m.
Fixes: Timeout (11sec -> 6sec)
Fixes: 16344/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ANM_fuzzer-5673032000995328

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

Comments

Peter Ross Aug. 16, 2019, 12:20 p.m.
On Thu, Aug 15, 2019 at 11:49:13PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (11sec -> 6sec)
> Fixes: 16344/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ANM_fuzzer-5673032000995328
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/anm.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/anm.c b/libavcodec/anm.c
> index ab6a3994e9..778f38413e 100644
> --- a/libavcodec/anm.c
> +++ b/libavcodec/anm.c
> @@ -119,6 +119,9 @@ static int decode_frame(AVCodecContext *avctx,
>      uint8_t *dst, *dst_end;
>      int count, ret;
>  
> +    if (buf_size < 7)
> +        return AVERROR_INVALIDDATA;
> +
>      if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
>          return ret;
>      dst     = s->frame->data[0];

approve.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
Michael Niedermayer Aug. 18, 2019, 8:46 a.m.
On Fri, Aug 16, 2019 at 10:20:42PM +1000, Peter Ross wrote:
> On Thu, Aug 15, 2019 at 11:49:13PM +0200, Michael Niedermayer wrote:
> > Fixes: Timeout (11sec -> 6sec)
> > Fixes: 16344/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ANM_fuzzer-5673032000995328
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/anm.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/libavcodec/anm.c b/libavcodec/anm.c
> > index ab6a3994e9..778f38413e 100644
> > --- a/libavcodec/anm.c
> > +++ b/libavcodec/anm.c
> > @@ -119,6 +119,9 @@ static int decode_frame(AVCodecContext *avctx,
> >      uint8_t *dst, *dst_end;
> >      int count, ret;
> >  
> > +    if (buf_size < 7)
> > +        return AVERROR_INVALIDDATA;
> > +
> >      if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
> >          return ret;
> >      dst     = s->frame->data[0];
> 
> approve.

will apply

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/anm.c b/libavcodec/anm.c
index ab6a3994e9..778f38413e 100644
--- a/libavcodec/anm.c
+++ b/libavcodec/anm.c
@@ -119,6 +119,9 @@  static int decode_frame(AVCodecContext *avctx,
     uint8_t *dst, *dst_end;
     int count, ret;
 
+    if (buf_size < 7)
+        return AVERROR_INVALIDDATA;
+
     if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
         return ret;
     dst     = s->frame->data[0];