[FFmpeg-cvslog] avcodec/anm: Check input size for a frame with just a stop code

Michael Niedermayer git at videolan.org
Wed Sep 4 22:26:30 EEST 2019


ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Thu Aug 15 21:00:54 2019 +0200| [9f61f2f1ea6df36487fba99f77decbef00445dc5] | committer: Michael Niedermayer

avcodec/anm: Check input size for a frame with just a stop code

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
Reviewed-by: Peter Ross <pross at xvid.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 1965161ef6d2aac8d3b034570c3da69dabca9e71)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f61f2f1ea6df36487fba99f77decbef00445dc5
---

 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];



More information about the ffmpeg-cvslog mailing list