]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/interplayvideo: Move parameter change check up
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 4 Feb 2017 01:45:02 +0000 (02:45 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 4 Feb 2017 01:45:46 +0000 (02:45 +0100)
Fixes out of array read
Fixes: 544/clusterfuzz-testcase-5936536407244800.f8bd9b24_8ba77916_70c2c7be_3df6a2ea_96cd9f14
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/interplayvideo.c

index abfc935f7b4413fc96dbf523b98fbb7ff11c89d5..8d2f3ab48c8569dca086b7f615bcb7f10c8bff6b 100644 (file)
@@ -989,6 +989,11 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
     AVFrame *frame = data;
     int ret;
 
+    if (av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, NULL)) {
+        av_frame_unref(s->last_frame);
+        av_frame_unref(s->second_last_frame);
+    }
+
     if (buf_size < 2)
         return AVERROR_INVALIDDATA;
 
@@ -1000,10 +1005,6 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
     if (buf_size < s->decoding_map_size + 2)
         return buf_size;
 
-    if (av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, NULL)) {
-        av_frame_unref(s->last_frame);
-        av_frame_unref(s->second_last_frame);
-    }
 
     s->decoding_map = buf + 2;
     bytestream2_init(&s->stream_ptr, buf + 2 + s->decoding_map_size,