aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-11-22 20:14:54 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-12-07 23:38:06 +0100
commite56f691283f0a793c3ae00711e98e316649f9f49 (patch)
treebe2a1d5bf9915d644ed2db96b7d449b75fcf3e5f
parent3ae71b648ad041cacd10db5be220eb2aeda2869b (diff)
downloadffmpeg-e56f691283f0a793c3ae00711e98e316649f9f49.tar.gz
avcodec/kgv1dec: Check that there is enough input for maximum RLE compression
Fixes: Timeout Fixes: 4271/clusterfuzz-testcase-4676667768307712 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 3aad94bf2b140cfba8ae69d018da05d4948ef37f) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/kgv1dec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c
index 5359411c76..a6bd9400ac 100644
--- a/libavcodec/kgv1dec.c
+++ b/libavcodec/kgv1dec.c
@@ -62,6 +62,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
h = (buf[1] + 1) * 8;
buf += 2;
+ if (avpkt->size < 2 + w*h / 513)
+ return AVERROR_INVALIDDATA;
+
if (w != avctx->width || h != avctx->height) {
av_freep(&c->frame_buffer);
av_freep(&c->last_frame_buffer);