Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-06-22 00:01:04 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-06 13:30:42 +0300
commit6a7e27f675e77297611137f0a5bd71454234e1e6 (patch)
treef1009ff3b9f74f43bc17c0e2d36194af8e74e4c3 /libavcodec/flicvideo.c
parentee2abfe7d4b9177102525a068821a2b523280bea (diff)
avcodec/flicvideo: Make line_packets int
Fixes: signed integer overflow: -32768 * 196032 cannot be represented in type 'int' Fixes: 15300/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-5733319519502336 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 54bd47f861e8cdc74aea816ebfbbaac25fefd0d1) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/flicvideo.c')
-rw-r--r--libavcodec/flicvideo.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
index c0e1e16bcd..99868f3ba3 100644
--- a/libavcodec/flicvideo.c
+++ b/libavcodec/flicvideo.c
@@ -175,7 +175,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
int lines;
int compressed_lines;
int starting_line;
- signed short line_packets;
+ int line_packets;
int y_ptr;
int byte_run;
int pixel_skip;
@@ -274,7 +274,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
break;
if (y_ptr > pixel_limit)
return AVERROR_INVALIDDATA;
- line_packets = bytestream2_get_le16(&g2);
+ line_packets = sign_extend(bytestream2_get_le16(&g2), 16);
if ((line_packets & 0xC000) == 0xC000) {
// line skip opcode
line_packets = -line_packets;
@@ -508,7 +508,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
int lines;
int compressed_lines;
- signed short line_packets;
+ int line_packets;
int y_ptr;
int byte_run;
int pixel_skip;
@@ -572,7 +572,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
break;
if (y_ptr > pixel_limit)
return AVERROR_INVALIDDATA;
- line_packets = bytestream2_get_le16(&g2);
+ line_packets = sign_extend(bytestream2_get_le16(&g2), 16);
if (line_packets < 0) {
line_packets = -line_packets;
if (line_packets > s->avctx->height)
@@ -806,7 +806,7 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
int lines;
int compressed_lines;
- signed short line_packets;
+ int line_packets;
int y_ptr;
int byte_run;
int pixel_skip;
@@ -870,7 +870,7 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
break;
if (y_ptr > pixel_limit)
return AVERROR_INVALIDDATA;
- line_packets = bytestream2_get_le16(&g2);
+ line_packets = sign_extend(bytestream2_get_le16(&g2), 16);
if (line_packets < 0) {
line_packets = -line_packets;
if (line_packets > s->avctx->height)