]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/jpeglsdec.c
Merge commit 'bc8c1cdc7bfe7b1fe56df812aabdac3de2555cec'
[ffmpeg] / libavcodec / jpeglsdec.c
index c133cfb2077448a1e25c8433a625fb5dd08e75bb..3af230d1db91a2128a567137a5880a5fd42e7bfc 100644 (file)
@@ -311,6 +311,10 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
                 ilv, point_transform, s->bits, s->cur_scan);
     }
     if (ilv == 0) { /* separate planes */
+        if (s->cur_scan > s->nb_components) {
+            ret = AVERROR_INVALIDDATA;
+            goto end;
+        }
         stride = (s->nb_components > 1) ? 3 : 1;
         off    = av_clip(s->cur_scan - 1, 0, stride - 1);
         width  = s->width * stride;