[FFmpeg-cvslog] jpeg2000: Validate block lengthinc

Luca Barbato git at videolan.org
Wed Jul 3 14:29:43 CEST 2013


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Mon Jul  1 10:01:05 2013 +0200| [7e201d575dc4385eb67314b0419d4d77185e65f4] | committer: Luca Barbato

jpeg2000: Validate block lengthinc

Currently we are using an array with a static data size.

Similar to a patch with the same purpose by Michael Niedermayer.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

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

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 9f7c92f..83efab8 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -663,6 +663,12 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s,
             cblk->lblock += llen;
             if ((ret = get_bits(s, av_log2(newpasses) + cblk->lblock)) < 0)
                 return ret;
+            if (ret > sizeof(cblk->data)) {
+                avpriv_request_sample(s->avctx,
+                                      "Block with lengthinc greater than %zu",
+                                      sizeof(cblk->data));
+                return AVERROR_PATCHWELCOME;
+            }
             cblk->lengthinc = ret;
             cblk->npasses  += newpasses;
         }



More information about the ffmpeg-cvslog mailing list