[FFmpeg-cvslog] avcodec/jpeg2000dec: Check bpno in decode_cblk()

Michael Niedermayer git at videolan.org
Fri Dec 4 19:09:41 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Dec  4 16:23:24 2015 +0100| [a85b02dcf70f62a6a433a607143f1f78fa5648bb] | committer: Michael Niedermayer

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 at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a85b02dcf70f62a6a433a607143f1f78fa5648bb
---

 libavcodec/jpeg2000dec.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 8cdc729..515d6a0 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1493,6 +1493,10 @@ static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
     ff_mqc_initdec(&t1->mqc, cblk->data, 0, 1);
 
     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,



More information about the ffmpeg-cvslog mailing list