Commit c32237e9 authored by Michael Niedermayer's avatar Michael Niedermayer

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/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 355e27e2)
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 28f2341e
...@@ -202,6 +202,9 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, ...@@ -202,6 +202,9 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
num_chunks = bytestream2_get_le16(&g2); num_chunks = bytestream2_get_le16(&g2);
bytestream2_skip(&g2, 8); /* skip padding */ bytestream2_skip(&g2, 8); /* skip padding */
if (frame_size < 16)
return AVERROR_INVALIDDATA;
frame_size -= 16; frame_size -= 16;
/* iterate through the chunks */ /* iterate through the chunks */
...@@ -520,6 +523,8 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, ...@@ -520,6 +523,8 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
if (frame_size > buf_size) if (frame_size > buf_size)
frame_size = buf_size; frame_size = buf_size;
if (frame_size < 16)
return AVERROR_INVALIDDATA;
frame_size -= 16; frame_size -= 16;
/* iterate through the chunks */ /* iterate through the chunks */
......
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