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:
authorMark Thompson <sw@jkqxz.net>2017-09-13 00:11:41 +0300
committerMark Thompson <sw@jkqxz.net>2017-09-13 00:11:41 +0300
commit44cde38c8acbef7d5250e6d1b52b1020871e093b (patch)
tree2629beca29d8ded943048da87affda1af7e4a285 /libavcodec/cbs_mpeg2.c
parentb05128f3c953bd66483e697d60a2e7e45ee9cfa0 (diff)
cbs: Always check for bitstream end before reading
Diffstat (limited to 'libavcodec/cbs_mpeg2.c')
-rw-r--r--libavcodec/cbs_mpeg2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c
index fede3ff471..cbee42e905 100644
--- a/libavcodec/cbs_mpeg2.c
+++ b/libavcodec/cbs_mpeg2.c
@@ -58,8 +58,9 @@
CHECK(ff_cbs_read_unsigned(ctx, rw, 1, "marker_bit", &one, 1, 1)); \
} while (0)
-#define nextbits(width, compare, var) (var = bitstream_peek(rw, width), \
- var == (compare))
+#define nextbits(width, compare, var) \
+ (bitstream_bits_left(rw) >= width && \
+ (var = bitstream_peek(rw, width)) == (compare))
#include "cbs_mpeg2_syntax_template.c"