aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-12-04 16:23:24 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-12-20 10:59:28 +0100
commit7294d95689f9d70f565cb3aa8f485bed1d79928b (patch)
treef07099e70ce750a50332bdcb21272add7b31418e
parent8681296bb97ff0baa6aa80548b08e33910a9fc8c (diff)
downloadffmpeg-7294d95689f9d70f565cb3aa8f485bed1d79928b.tar.gz
avcodec/jpeg2000dec: Check bpno in decode_cblk()
Fixes: undefined shift Fixes: c409ef86f892335a0a164b5871174d5a/asan_heap-oob_1dff564_2159_162b7234616deab02b544410455eb07b.mov Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit a85b02dcf70f62a6a433a607143f1f78fa5648bb) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/jpeg2000dec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 66f126fdc7..1f71afd3a0 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1081,6 +1081,10 @@ static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
ff_mqc_initdec(&t1->mqc, cblk->data);
while (passno--) {
+ if (bpno < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "bpno became negative\n");
+ return AVERROR_INVALIDDATA;
+ }
switch(pass_t) {
case 0:
decode_sigpass(t1, width, height, bpno + 1, bandpos,