Skip to content
Snippets Groups Projects
Commit a8a98ba9 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

avcodec/wcmv: Fix integer overflows

Fixes: signed integer overflow: 262140 * 65535 cannot be represented in type 'int'
Fixes: 10090/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WCMV_fuzzer-5691269368512512

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg


Signed-off-by: default avatarMichael Niedermayer <michael@niedermayer.cc>
parent 2076e118
No related branches found
No related tags found
No related merge requests found
...@@ -113,6 +113,8 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -113,6 +113,8 @@ static int decode_frame(AVCodecContext *avctx,
bytestream2_skip(&bgb, 4); bytestream2_skip(&bgb, 4);
w = bytestream2_get_le16(&bgb); w = bytestream2_get_le16(&bgb);
h = bytestream2_get_le16(&bgb); h = bytestream2_get_le16(&bgb);
if (x + bpp * (int64_t)w * h > INT_MAX)
return AVERROR_INVALIDDATA;
x += bpp * w * h; x += bpp * w * h;
} }
...@@ -140,6 +142,8 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -140,6 +142,8 @@ static int decode_frame(AVCodecContext *avctx,
bytestream2_skip(&gb, 4); bytestream2_skip(&gb, 4);
w = bytestream2_get_le16(&gb); w = bytestream2_get_le16(&gb);
h = bytestream2_get_le16(&gb); h = bytestream2_get_le16(&gb);
if (x + bpp * (int64_t)w * h > INT_MAX)
return AVERROR_INVALIDDATA;
x += bpp * w * h; x += bpp * w * h;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment