1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-17 20:17:55 +02:00

avcodec/pixlet: Fix runtime error: signed integer overflow: 2147483647 + 32 cannot be represented in type 'int'

Fixes: 1829/clusterfuzz-testcase-minimized-5527165321871360

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 77d98898211eeb0241e8411428b0b364a6231744)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2017-05-27 13:03:36 +02:00
parent 92a23e2a63
commit dbff2d602d

View File

@ -594,6 +594,10 @@ static int pixlet_decode_frame(AVCodecContext *avctx, void *data,
width = bytestream2_get_be32(&ctx->gb); width = bytestream2_get_be32(&ctx->gb);
height = bytestream2_get_be32(&ctx->gb); height = bytestream2_get_be32(&ctx->gb);
if ( width > INT_MAX - (1U << (NB_LEVELS + 1))
|| height > INT_MAX - (1U << (NB_LEVELS + 1)))
return AVERROR_INVALIDDATA;
w = FFALIGN(width, 1 << (NB_LEVELS + 1)); w = FFALIGN(width, 1 << (NB_LEVELS + 1));
h = FFALIGN(height, 1 << (NB_LEVELS + 1)); h = FFALIGN(height, 1 << (NB_LEVELS + 1));