avcodec/exr: Check uncompressed_size against max_pixels

Fixes: Timeout
Fixes: 35286/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6557139802914816
Fixes: 31253/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-4901782326214656

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:
Michael Niedermayer 2021-06-27 19:25:06 +02:00
parent cf12a478b2
commit adae546f24
1 changed files with 3 additions and 0 deletions

View File

@ -1299,6 +1299,9 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
axmax = FFMAX(0, (avctx->width - (s->xmax + 1))) * step;
}
if (avctx->max_pixels && uncompressed_size > avctx->max_pixels * 16LL)
return AVERROR_INVALIDDATA;
if (data_size < uncompressed_size || s->is_tile) { /* td->tmp is use for tile reorganization */
av_fast_padded_malloc(&td->tmp, &td->tmp_size, uncompressed_size);
if (!td->tmp)