[FFmpeg-cvslog] avformat/img2dec: do not rewind custom io buffers

Michael Niedermayer git at videolan.org
Sat May 16 00:16:06 CEST 2015


ffmpeg | branch: release/2.6 | Michael Niedermayer <michaelni at gmx.at> | Mon Apr 20 23:59:53 2015 +0200| [a75f293264f304e905f07cfa2debb070af2981e4] | committer: Michael Niedermayer

avformat/img2dec: do not rewind custom io buffers

Fixes double free with some applications

Fixes vlc ticket14121
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit e6e8cc8ce9c2a398fbb51254a5067f4bd3c4fa8a)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a75f293264f304e905f07cfa2debb070af2981e4
---

 libavformat/img2dec.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 8c5e9d5..5fc5b83 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -341,7 +341,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);



More information about the ffmpeg-cvslog mailing list