aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-28 01:23:40 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-01 13:28:14 +0100
commit8e95ddbe82c4bb50e117e791b1b45edfd1b764dd (patch)
tree85eb3c6ad9020c59bd9afc16b3f52fead02f1398 /libavcodec
parent8cba067fe52a717bdd2d3ed16c5c06bce54fa7a0 (diff)
downloadffmpeg-8e95ddbe82c4bb50e117e791b1b45edfd1b764dd.tar.gz
avcodec/diracdec: Tighter checks on CODEBLOCKS_X/Y
Fixes very long but finite loop Fixes: asan_heap-oob_107866c_42_041.drc Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 5145d22b88b9835db81c4d286b931a78e08ab76a) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/diracdec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 0511f1c391..aa8e2b0db9 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -1004,8 +1004,8 @@ static int dirac_unpack_idwt_params(DiracContext *s)
/* Codeblock parameters (core syntax only) */
if (get_bits1(gb)) {
for (i = 0; i <= s->wavelet_depth; i++) {
- CHECKEDREAD(s->codeblock[i].width , tmp < 1, "codeblock width invalid\n")
- CHECKEDREAD(s->codeblock[i].height, tmp < 1, "codeblock height invalid\n")
+ CHECKEDREAD(s->codeblock[i].width , tmp < 1 || tmp > (s->avctx->width >>s->wavelet_depth-i), "codeblock width invalid\n")
+ CHECKEDREAD(s->codeblock[i].height, tmp < 1 || tmp > (s->avctx->height>>s->wavelet_depth-i), "codeblock height invalid\n")
}
CHECKEDREAD(s->codeblock_mode, tmp > 1, "unknown codeblock mode\n")