aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-04-20 23:59:53 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-21 00:12:17 +0200
commit3f629c83b462bbafbc262fbc7f1488a2d8f3b13e (patch)
treee905755980e17abfe524afac0a3ac24790bf9c4d
parentfaac8e43315dae5818816bcebe52d11777b064b2 (diff)
downloadffmpeg-3f629c83b462bbafbc262fbc7f1488a2d8f3b13e.tar.gz
avformat/img2dec: do not rewind custom io buffers
Fixes double free with some applications Fixes vlc ticket14121 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit e6e8cc8ce9c2a398fbb51254a5067f4bd3c4fa8a) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/img2dec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index a20868cbaf..1a31ac870b 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -339,7 +339,10 @@ int ff_img_read_header(AVFormatContext *s1)
break;
}
}
- ffio_rewind_with_probe_data(s1->pb, &probe_buffer, probe_buffer_size);
+ if (s1->flags & AVFMT_FLAG_CUSTOM_IO) {
+ avio_seek(s1->pb, 0, SEEK_SET);
+ } else
+ ffio_rewind_with_probe_data(s1->pb, &probe_buffer, probe_buffer_size);
}
if (st->codec->codec_id == AV_CODEC_ID_NONE)
st->codec->codec_id = ff_guess_image2_codec(s->path);