aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-17 01:12:55 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-17 02:40:21 +0200
commit792f15c109cc7f64d19ed139f63dcb4b33329eba (patch)
tree6e3d1fbb51d5e5bfac1f7f9f340b8befeddd6a97
parent63cc52ed97f57ae47f47118ee84ac3877c591b82 (diff)
downloadffmpeg-792f15c109cc7f64d19ed139f63dcb4b33329eba.tar.gz
avcodec/flicvideo: Check frame_size before decrementing
Fixes: runtime error: signed integer overflow: -2147483627 - 22 cannot be represented in type 'int' Fixes: 1637/clusterfuzz-testcase-minimized-5376582493405184 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 355e27e24dc88d6ba8f27501a34925d9d937a399) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/flicvideo.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
index c9c6c24e55..192d4fe8a7 100644
--- a/libavcodec/flicvideo.c
+++ b/libavcodec/flicvideo.c
@@ -202,6 +202,9 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
num_chunks = bytestream2_get_le16(&g2);
bytestream2_skip(&g2, 8); /* skip padding */
+ if (frame_size < 16)
+ return AVERROR_INVALIDDATA;
+
frame_size -= 16;
/* iterate through the chunks */
@@ -522,6 +525,8 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
if (frame_size > buf_size)
frame_size = buf_size;
+ if (frame_size < 16)
+ return AVERROR_INVALIDDATA;
frame_size -= 16;
/* iterate through the chunks */