Browse Source

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>
tags/n3.4
Michael Niedermayer 8 years ago
parent
commit
edc88646ee
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libavcodec/diracdec.c

+ 4
- 1
libavcodec/diracdec.c View File

@@ -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;


Loading…
Cancel
Save