aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-23 22:18:52 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-24 15:51:11 +0200
commit4bc3008d04451cd31818e21703ed7ed96b6ff074 (patch)
tree84aa94f3681e0c115fa83d1055d5fb54be5a2e6c
parent11827ea3f04181f4ba1f952f4e51111ebf4a2d22 (diff)
downloadffmpeg-4bc3008d04451cd31818e21703ed7ed96b6ff074.tar.gz
avcodec/jpeglsdec: Check get_bits_left() before decoding a picture
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/jpeglsdec.c4
1 files changed, 4 insertions, 0 deletions
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;