mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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>
This commit is contained in:
parent
4373bb411c
commit
54bd47f861
@ -175,7 +175,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
|
|||||||
int lines;
|
int lines;
|
||||||
int compressed_lines;
|
int compressed_lines;
|
||||||
int starting_line;
|
int starting_line;
|
||||||
signed short line_packets;
|
int line_packets;
|
||||||
int y_ptr;
|
int y_ptr;
|
||||||
int byte_run;
|
int byte_run;
|
||||||
int pixel_skip;
|
int pixel_skip;
|
||||||
@ -274,7 +274,7 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
|
|||||||
break;
|
break;
|
||||||
if (y_ptr > pixel_limit)
|
if (y_ptr > pixel_limit)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
line_packets = bytestream2_get_le16(&g2);
|
line_packets = sign_extend(bytestream2_get_le16(&g2), 16);
|
||||||
if ((line_packets & 0xC000) == 0xC000) {
|
if ((line_packets & 0xC000) == 0xC000) {
|
||||||
// line skip opcode
|
// line skip opcode
|
||||||
line_packets = -line_packets;
|
line_packets = -line_packets;
|
||||||
@ -508,7 +508,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
|
|||||||
|
|
||||||
int lines;
|
int lines;
|
||||||
int compressed_lines;
|
int compressed_lines;
|
||||||
signed short line_packets;
|
int line_packets;
|
||||||
int y_ptr;
|
int y_ptr;
|
||||||
int byte_run;
|
int byte_run;
|
||||||
int pixel_skip;
|
int pixel_skip;
|
||||||
@ -572,7 +572,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
|
|||||||
break;
|
break;
|
||||||
if (y_ptr > pixel_limit)
|
if (y_ptr > pixel_limit)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
line_packets = bytestream2_get_le16(&g2);
|
line_packets = sign_extend(bytestream2_get_le16(&g2), 16);
|
||||||
if (line_packets < 0) {
|
if (line_packets < 0) {
|
||||||
line_packets = -line_packets;
|
line_packets = -line_packets;
|
||||||
if (line_packets > s->avctx->height)
|
if (line_packets > s->avctx->height)
|
||||||
@ -806,7 +806,7 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
|
|||||||
|
|
||||||
int lines;
|
int lines;
|
||||||
int compressed_lines;
|
int compressed_lines;
|
||||||
signed short line_packets;
|
int line_packets;
|
||||||
int y_ptr;
|
int y_ptr;
|
||||||
int byte_run;
|
int byte_run;
|
||||||
int pixel_skip;
|
int pixel_skip;
|
||||||
@ -870,7 +870,7 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
|
|||||||
break;
|
break;
|
||||||
if (y_ptr > pixel_limit)
|
if (y_ptr > pixel_limit)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
line_packets = bytestream2_get_le16(&g2);
|
line_packets = sign_extend(bytestream2_get_le16(&g2), 16);
|
||||||
if (line_packets < 0) {
|
if (line_packets < 0) {
|
||||||
line_packets = -line_packets;
|
line_packets = -line_packets;
|
||||||
if (line_packets > s->avctx->height)
|
if (line_packets > s->avctx->height)
|
||||||
|
Loading…
Reference in New Issue
Block a user