diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-23 22:18:52 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-06-05 23:16:54 +0200 |
commit | 52e470097aee85fef6d9342b71ee19c90b63f69f (patch) | |
tree | fb3a58e3e7e848fb2546b2c543d5e3cfc0b52096 | |
parent | 5148395e86e64303217fc8f9e5d13fe50ea3bea9 (diff) | |
download | ffmpeg-52e470097aee85fef6d9342b71ee19c90b63f69f.tar.gz |
avcodec/jpeglsdec: Check get_bits_left() before decoding a picture
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4bc3008d04451cd31818e21703ed7ed96b6ff074)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/jpeglsdec.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c index 68151cbbd8..20b40445fd 100644 --- a/libavcodec/jpeglsdec.c +++ b/libavcodec/jpeglsdec.c @@ -385,6 +385,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; |