[FFmpeg-devel] [PATCH 2/3] avformat/aviobuf: Check if the IO context is resizeable before resizing
Michael Niedermayer
michaelni at gmx.at
Tue Apr 21 13:22:01 CEST 2015
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavformat/aviobuf.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index b32ff9f..3aa2b2d 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -809,6 +809,8 @@ int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
if (buf_size < filled || s->seekable)
return 0;
av_assert0(!s->write_flag);
+ if (!s->resizeable)
+ return AVERROR(EINVAL);
buffer = av_malloc(buf_size);
if (!buffer)
@@ -873,6 +875,14 @@ int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char **bufp, int buf_si
return AVERROR(EINVAL);
}
+ if (!s->resizeable) {
+ int64_t ret = avio_seek(s, 0, SEEK_SET);
+ av_freep(bufp);
+ if (ret < 0)
+ return ret;
+ return 0;
+ }
+
overlap = buf_size - buffer_start;
new_size = buf_size + buffer_size - overlap;
--
1.7.9.5
More information about the ffmpeg-devel
mailing list