1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/rscc: Check pixel_size for overflow

Fixes: 1509/clusterfuzz-testcase-minimized-5129419876204544

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 934572c5c3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2017-05-13 01:31:19 +02:00
parent a359138fb3
commit 0246760e94

View File

@ -184,6 +184,12 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
ctx->tiles[i].y = bytestream2_get_le16(gbc);
ctx->tiles[i].h = bytestream2_get_le16(gbc);
if (pixel_size + ctx->tiles[i].w * (int64_t)ctx->tiles[i].h * 4 > INT_MAX) {
av_log(avctx, AV_LOG_ERROR, "Invalid tile dimensions\n");
ret = AVERROR_INVALIDDATA;
goto end;
}
pixel_size += ctx->tiles[i].w * ctx->tiles[i].h * 4;
ff_dlog(avctx, "tile %d orig(%d,%d) %dx%d.\n", i,