aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-08-01 01:49:47 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-15 12:25:45 +0100
commit87a487157190d88574b44759bbf5d0b5299ed388 (patch)
treec332141078d7bbace2c971303c8ca8c84c5606b3
parentb9b9106f25d2608bec368164a6e2273d922f4db1 (diff)
downloadffmpeg-87a487157190d88574b44759bbf5d0b5299ed388.tar.gz
avcodec/diracdec: Check that slices are fewer than pixels
Fixes: Timeout (197sec ->144ms) Fixes: 15034/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5733549405110272 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit fbbc8ba67f19d55380b1bc8b5f057328c266d747) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/diracdec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index f81a041834..69828c4589 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -1252,7 +1252,9 @@ static int dirac_unpack_idwt_params(DiracContext *s)
s->num_y = get_interleaved_ue_golomb(gb);
if (s->num_x * s->num_y == 0 || s->num_x * (uint64_t)s->num_y > INT_MAX ||
s->num_x * (uint64_t)s->avctx->width > INT_MAX ||
- s->num_y * (uint64_t)s->avctx->height > INT_MAX
+ s->num_y * (uint64_t)s->avctx->height > INT_MAX ||
+ s->num_x > s->avctx->width ||
+ s->num_y > s->avctx->height
) {
av_log(s->avctx,AV_LOG_ERROR,"Invalid numx/y\n");
s->num_x = s->num_y = 0;