[FFmpeg-cvslog] avcodec/jpeglsdec: Check get_bits_left() before decoding a picture

Michael Niedermayer git at videolan.org
Fri Jun 2 03:07:13 EEST 2017


ffmpeg | branch: release/3.3 | Michael Niedermayer <michael at niedermayer.cc> | Tue May 23 22:18:52 2017 +0200| [ba7ea7c4b1aa0f3c4b65db4f218c54a97d0f942f] | committer: Michael Niedermayer

avcodec/jpeglsdec: Check get_bits_left() before decoding a picture

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 4bc3008d04451cd31818e21703ed7ed96b6ff074)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index c8550e47ea..64505321af 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -390,6 +390,10 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
         av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
                 ilv, point_transform, s->bits, s->cur_scan);
     }
+    if (get_bits_left(&s->gb) < s->height) {
+        ret = AVERROR_INVALIDDATA;
+        goto end;
+    }
     if (ilv == 0) { /* separate planes */
         if (s->cur_scan > s->nb_components) {
             ret = AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list