[FFmpeg-cvslog] avcodec/jpeglsdec/ff_jpegls_decode_lse: check len field validity

Michael Niedermayer git at videolan.org
Wed Apr 9 23:18:06 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Apr  9 23:05:15 2014 +0200| [2773ab36cc6480ce77845df0b1d1e2f790c59cde] | committer: Michael Niedermayer

avcodec/jpeglsdec/ff_jpegls_decode_lse: check len field validity

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

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

 libavcodec/jpeglsdec.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index 13b6e41..d8e2bdb 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -52,11 +52,14 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s)
     int id;
     int tid, wt, maxtab, i, j;
 
-    int len = get_bits(&s->gb, 16);  /* length: FIXME: verify field validity */
+    int len = get_bits(&s->gb, 16);
     id = get_bits(&s->gb, 8);
 
     switch (id) {
     case 1:
+        if (len < 13)
+            return AVERROR_INVALIDDATA;
+
         s->maxval = get_bits(&s->gb, 16);
         s->t1     = get_bits(&s->gb, 16);
         s->t2     = get_bits(&s->gb, 16);



More information about the ffmpeg-cvslog mailing list