Module: libav Branch: release/11 Commit: 48c6280db0092da5baecfe69b3a3785f70257875
Author: Anton Khirnov <[email protected]> Committer: Anton Khirnov <[email protected]> Date: Tue Aug 2 21:16:44 2016 +0200 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: [email protected] Reported-By: wm4 <[email protected]> (cherry picked from commit 24a362569bff1d4161742fffaca80a4a4428be8a) Signed-off-by: Anton Khirnov <[email protected]> --- libavutil/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/buffer.c b/libavutil/buffer.c index 1bc4a93..8bfb649 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; _______________________________________________ libav-commits mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-commits
