[FFmpeg-devel] [PATCH] avcodec/agm: More completely check size before using it

Michael Niedermayer michael at niedermayer.cc
Thu Apr 4 12:31:51 EEST 2019


On Wed, Apr 03, 2019 at 10:14:22AM +0200, Paul B Mahol wrote:
> On 4/3/19, Michael Niedermayer <michael at niedermayer.cc> wrote:
> > Fixes: out of array access
> > Fixes:
> > 13997/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5701427252428800
> >
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavcodec/agm.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/agm.c b/libavcodec/agm.c
> > index b0e8b80f81..2d2092222d 100644
> > --- a/libavcodec/agm.c
> > +++ b/libavcodec/agm.c
> > @@ -562,7 +562,8 @@ static int decode_frame(AVCodecContext *avctx, void
> > *data,
> >
> >      for (int i = 0; i < 3; i++)
> >          s->size[i] = bytestream2_get_le32(gbyte);
> > -    if (32LL + s->size[0] + s->size[1] + s->size[2] > avpkt->size)
> > +    if (s->size[0] < 0 || s->size[1] < 0 || s->size[2] < 0 ||
> > +        32LL + s->size[0] + s->size[1] + s->size[2] > avpkt->size)
> >          return AVERROR_INVALIDDATA;
> >
> >      if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
> > --
> > 2.21.0
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> 
> OK

will apply

thanks

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

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190404/203149f0/attachment.sig>


More information about the ffmpeg-devel mailing list