avcodec/smvjpegdec: check avcodec_decode_video2() return code
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 15 May 2015 15:21:10 +0000 (17:21 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 10 Jun 2015 00:13:11 +0000 (02:13 +0200)
Fixes CID1271810

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cdd25f9a3df3905543a5546cf6076d2eaf895736)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/smvjpegdec.c

index 7d84839..9d9ad63 100644 (file)
@@ -137,6 +137,10 @@ static int smvjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_siz
     if (!cur_frame) {
         av_frame_unref(mjpeg_data);
         ret = avcodec_decode_video2(s->avctx, mjpeg_data, &s->mjpeg_data_size, avpkt);
+        if (ret < 0) {
+            s->mjpeg_data_size = 0;
+            return ret;
+        }
     } else if (!s->mjpeg_data_size)
         return AVERROR(EINVAL);