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 e6e8cc8ce9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-04-20 23:59:53 +02:00
parent 0014b24373
commit 8c832e3cc0
1 changed files with 4 additions and 1 deletions

View File

@ -339,6 +339,9 @@ int ff_img_read_header(AVFormatContext *s1)
break; break;
} }
} }
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); ffio_rewind_with_probe_data(s1->pb, &probe_buffer, probe_buffer_size);
} }
if (st->codec->codec_id == AV_CODEC_ID_NONE) if (st->codec->codec_id == AV_CODEC_ID_NONE)