aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-08-20 19:21:07 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-09-05 01:01:35 +0200
commit4ab41164d23899716d79752511fb9d975a264016 (patch)
tree946b903d025e64c1a98ba5b471aae89c6c55d9d2 /libavcodec
parentd794d97d960341ae6ad6294446b8799dcf80e811 (diff)
downloadffmpeg-4ab41164d23899716d79752511fb9d975a264016.tar.gz
avcodec/diracdec: Check numx/y
Fixes division by 0 Fixes: 60261c4469ba3e11059890fb2832a515/asan_generic_135e694_2790_beb94eaa0aeb7d11c0437375a8964a99.drc Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit a31e08fa1aa5c5f0518b8af850f28eb945268e66) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/diracdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 1d7bb9b98b..1242bd821d 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -1153,6 +1153,11 @@ static int dirac_unpack_idwt_params(DiracContext *s)
else {
s->num_x = svq3_get_ue_golomb(gb);
s->num_y = svq3_get_ue_golomb(gb);
+ if (s->num_x * s->num_y == 0 || s->num_x * (uint64_t)s->num_y > INT_MAX) {
+ av_log(s->avctx,AV_LOG_ERROR,"Invalid numx/y\n");
+ s->num_x = s->num_y = 0;
+ return AVERROR_INVALIDDATA;
+ }
if (s->ld_picture) {
s->lowdelay.bytes.num = svq3_get_ue_golomb(gb);
s->lowdelay.bytes.den = svq3_get_ue_golomb(gb);