Commit 8e3b01e2 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/agm: More completely check size before using it

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/ffmpegReviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent ee16d14b
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment