[FFmpeg-cvslog] avcodec/jpeg2000dec: check sample sepration for validity

Michael Niedermayer git at videolan.org
Wed Aug 7 15:14:19 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Aug  7 15:02:38 2013 +0200| [5cd57e8758e336e86698d4994ee088077869e42d] | committer: Michael Niedermayer

avcodec/jpeg2000dec: check sample sepration for validity

Fixes division by 0
Fixes Ticket2841

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index fb4e52b..1eb20ac 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -273,6 +273,10 @@ static int get_siz(Jpeg2000DecoderContext *s)
         s->sgnd[i]   = !!(x & 0x80);
         s->cdx[i]    = bytestream2_get_byteu(&s->g);
         s->cdy[i]    = bytestream2_get_byteu(&s->g);
+        if (!s->cdx[i] || !s->cdy[i]) {
+            av_log(s->avctx, AV_LOG_ERROR, "Invalid sample seperation\n");
+            return AVERROR_INVALIDDATA;
+        }
         log2_chroma_wh |= s->cdy[i] >> 1 << i * 4 | s->cdx[i] >> 1 << i * 4 + 2;
     }
 



More information about the ffmpeg-cvslog mailing list