diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-13 01:31:19 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-17 20:35:20 +0200 |
commit | 0246760e94510844918334cd0d1297ce297822b7 (patch) | |
tree | 59da5d4bfbe9c1980f60395f0feef205f0f18943 /libavcodec/rscc.c | |
parent | a359138fb3aaa923e3a3d9fb62b140a299f56056 (diff) | |
download | ffmpeg-0246760e94510844918334cd0d1297ce297822b7.tar.gz |
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 934572c5c3592732a30336afdf2df9926a8b4df2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/rscc.c')
-rw-r--r-- | libavcodec/rscc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c index 0c3e81845d..78a8bcea0b 100644 --- a/libavcodec/rscc.c +++ b/libavcodec/rscc.c @@ -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, |