Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2015-07-10 10:31:24 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-20 05:43:41 +0300
commitc5c141bc699f9b6f2e5613bc826b0943b70e1011 (patch)
treeb661e4327e8d718b9a8cba86386244048a290594
parent6c98d5e7c83f18f8e9b65c0214d5593c0436a473 (diff)
bytestream2: set the reader to the end when reading more than available
This prevents possible infinite loops with the calling code along the lines of while (bytestream2_get_bytes_left()) { ... }, where the reader does not advance. CC: libav-stable@libav.org (cherry picked from commit 86eee85daddb682fa072c2e2657c90a514b855e3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/bytestream.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/bytestream.h b/libavcodec/bytestream.h
index c2cb601806..7c05ea6cf5 100644
--- a/libavcodec/bytestream.h
+++ b/libavcodec/bytestream.h
@@ -71,8 +71,10 @@ static av_always_inline type bytestream2_get_ ## name ## u(GetByteContext *g) \
} \
static av_always_inline type bytestream2_get_ ## name(GetByteContext *g) \
{ \
- if (g->buffer_end - g->buffer < bytes) \
+ if (g->buffer_end - g->buffer < bytes) { \
+ g->buffer = g->buffer_end; \
return 0; \
+ } \
return bytestream2_get_ ## name ## u(g); \
} \
static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g) \