summaryrefslogtreecommitdiffstats
path: root/libavcodec/diracdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-07-19 00:59:21 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-07-21 17:37:05 +0200
commitedc88646ee407bc342cc94ff495aadafcd377cee (patch)
tree3695f9ad85a40d44913fa1189eab1b81ce867513 /libavcodec/diracdec.c
parent1196e53b701369d7f0c886f69f3d8f50f54e7412 (diff)
downloadffmpeg-streaming-edc88646ee407bc342cc94ff495aadafcd377cee.zip
ffmpeg-streaming-edc88646ee407bc342cc94ff495aadafcd377cee.tar.gz
avcodec/diracdec: Check dimensions which are closer to what is allocated in alloc_sequence_buffers()
Fixes OOM Fixes: 2674/clusterfuzz-testcase-minimized-4999700518273024 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/diracdec.c')
-rw-r--r--libavcodec/diracdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index c031b40..71d0ff4 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -2090,7 +2090,10 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
return ret;
}
- ret = ff_set_dimensions(avctx, dsh->width, dsh->height);
+ if (CALC_PADDING((int64_t)dsh->width, MAX_DWT_LEVELS) * CALC_PADDING((int64_t)dsh->height, MAX_DWT_LEVELS) > avctx->max_pixels)
+ ret = AVERROR(ERANGE);
+ if (ret >= 0)
+ ret = ff_set_dimensions(avctx, dsh->width, dsh->height);
if (ret < 0) {
av_freep(&dsh);
return ret;
OpenPOWER on IntegriCloud