diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-08-02 21:16:44 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-08-03 11:07:15 +0200 |
commit | 24a362569bff1d4161742fffaca80a4a4428be8a (patch) | |
tree | ce3f110ae279017c59e48cb21eb1c3ef85ed44f3 | |
parent | e99ecda55082cb9dde8fd349361e169dc383943a (diff) | |
download | ffmpeg-streaming-24a362569bff1d4161742fffaca80a4a4428be8a.zip ffmpeg-streaming-24a362569bff1d4161742fffaca80a4a4428be8a.tar.gz |
buffer: fix av_buffer_realloc() when the data is offset wrt buffer start
In such a case behave as if the buffer was not reallocatable -- allocate a
new one and copy the data (preserving just the part described by the
reference passed to av_buffer_realloc).
CC: libav-stable@libav.org
Reported-By: wm4 <nfxjfg@googlemail.com>
-rw-r--r-- | libavutil/buffer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavutil/buffer.c b/libavutil/buffer.c index 6681002..49a1f2d 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -170,7 +170,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) return 0; if (!(buf->buffer->flags & BUFFER_FLAG_REALLOCATABLE) || - !av_buffer_is_writable(buf)) { + !av_buffer_is_writable(buf) || buf->data != buf->buffer->data) { /* cannot realloc, allocate a new reallocable buffer and copy data */ AVBufferRef *new = NULL; |