[FFmpeg-devel] [PATCH] avcodec/agm: More completely check size before using it
Paul B Mahol
onemda at gmail.com
Wed Apr 3 11:14:22 EEST 2019
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
More information about the ffmpeg-devel
mailing list