[FFmpeg-cvslog] avcodec/flicvideo: Fix runtime error: signed integer overflow: 4864 * 459296 cannot be represented in type 'int'
Michael Niedermayer
git at videolan.org
Sun Jun 18 17:34:48 EEST 2017
ffmpeg | branch: release/3.1 | Michael Niedermayer <michael at niedermayer.cc> | Sat Jun 10 19:43:25 2017 +0200| [4f2aaccff0ecc3a0b5f3c1791c7bb5837ae3f602] | committer: Michael Niedermayer
avcodec/flicvideo: Fix runtime error: signed integer overflow: 4864 * 459296 cannot be represented in type 'int'
Fixes: 2174/clusterfuzz-testcase-minimized-5739234533048320
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 90e8317b3b33dcb54ae01e419d85cbbfbd874963)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4f2aaccff0ecc3a0b5f3c1791c7bb5837ae3f602
---
libavcodec/flicvideo.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
index 192d4fe8a7..157f0c31a7 100644
--- a/libavcodec/flicvideo.c
+++ b/libavcodec/flicvideo.c
@@ -275,10 +275,14 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
while (compressed_lines > 0) {
if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk)
break;
+ if (y_ptr > pixel_limit)
+ return AVERROR_INVALIDDATA;
line_packets = bytestream2_get_le16(&g2);
if ((line_packets & 0xC000) == 0xC000) {
// line skip opcode
line_packets = -line_packets;
+ if (line_packets > s->avctx->height)
+ return AVERROR_INVALIDDATA;
y_ptr += line_packets * s->frame->linesize[0];
} else if ((line_packets & 0xC000) == 0x4000) {
av_log(avctx, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", line_packets);
@@ -327,6 +331,8 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
case FLI_LC:
/* line compressed */
starting_line = bytestream2_get_le16(&g2);
+ if (starting_line >= s->avctx->height)
+ return AVERROR_INVALIDDATA;
y_ptr = 0;
y_ptr += starting_line * s->frame->linesize[0];
@@ -563,9 +569,13 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
while (compressed_lines > 0) {
if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk)
break;
+ if (y_ptr > pixel_limit)
+ return AVERROR_INVALIDDATA;
line_packets = bytestream2_get_le16(&g2);
if (line_packets < 0) {
line_packets = -line_packets;
+ if (line_packets > s->avctx->height)
+ return AVERROR_INVALIDDATA;
y_ptr += line_packets * s->frame->linesize[0];
} else {
compressed_lines--;
More information about the ffmpeg-cvslog
mailing list