[FFmpeg-cvslog] jpeg2000dec: return error for invalid cdxy values

Michael Niedermayer git at videolan.org
Wed Jun 5 23:39:07 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Jun  5 23:05:13 2013 +0200| [bbc19010edfdb1b2e248a24894c5ec77960bbfc3] | committer: Michael Niedermayer

jpeg2000dec: return error for invalid cdxy values

Fixes division by 0

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 921362f..e8e95a1 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -194,6 +194,8 @@ static int get_siz(Jpeg2000DecoderContext *s)
         s->cdy[i]    = bytestream2_get_byteu(&s->g);
         if (s->cdx[i] != 1 || s->cdy[i] != 1) {
             av_log(s->avctx, AV_LOG_ERROR, "unsupported/ CDxy values %d %d for component %d\n", s->cdx[i], s->cdy[i], i);
+            if (!s->cdx[i] || !s->cdy[i])
+                return AVERROR_INVALIDDATA;
         }
     }
 



More information about the ffmpeg-cvslog mailing list