aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-02-04 02:45:02 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-02-08 20:32:01 +0100
commit1f35ea813d6cc831a99ab340016cb7b38d8f7f36 (patch)
tree8f447f466c902aa8342084c45a2a730b9fc1c02a /libavcodec
parentc26c8bb23a51cf6392b3a825ca48b8bd4c87b582 (diff)
downloadffmpeg-1f35ea813d6cc831a99ab340016cb7b38d8f7f36.tar.gz
avcodec/interplayvideo: Move parameter change check up
Fixes out of array read Fixes: 544/clusterfuzz-testcase-5936536407244800.f8bd9b24_8ba77916_70c2c7be_3df6a2ea_96cd9f14 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit b1e2192007d7026049237c9ab11e05ae71bf4f42) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/interplayvideo.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c
index 899f52cb3c..2b78c69200 100644
--- a/libavcodec/interplayvideo.c
+++ b/libavcodec/interplayvideo.c
@@ -988,6 +988,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;
@@ -999,10 +1004,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,