mjpegdec: properly report unsupported disabled features
authorLuca Barbato <lu_zero@gentoo.org>
Tue, 14 May 2013 13:27:26 +0000 (15:27 +0200)
committerReinhard Tartler <siretart@tauware.de>
Fri, 31 May 2013 21:00:30 +0000 (23:00 +0200)
When JPEG-LS support is disabled the decoder would feed the
data to the JPEG Lossless decode_*_scan function resulting in
faulty decoding.

CC: libav-stable@libav.org
(cherry picked from commit b25e49b187617c486ae3f50a5cbb356fc0e868bb)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
libavcodec/mjpegdec.c

index 0b22bca..4956e3a 100644 (file)
@@ -1489,6 +1489,12 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
             else if (start_code == COM)
                 mjpeg_decode_com(s);
 
+            if (!CONFIG_JPEGLS_DECODER &&
+                (start_code == SOF48 || start_code == LSE)) {
+                av_log(avctx, AV_LOG_ERROR, "JPEG-LS support not enabled.\n");
+                return AVERROR(ENOSYS);
+            }
+
             switch (start_code) {
             case SOI:
                 s->restart_interval = 0;