diff options
author | Mark Thompson <sw@jkqxz.net> | 2017-09-12 22:11:41 +0100 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2017-09-12 22:11:41 +0100 |
commit | 44cde38c8acbef7d5250e6d1b52b1020871e093b (patch) | |
tree | 2629beca29d8ded943048da87affda1af7e4a285 /libavcodec/cbs.c | |
parent | b05128f3c953bd66483e697d60a2e7e45ee9cfa0 (diff) | |
download | ffmpeg-44cde38c8acbef7d5250e6d1b52b1020871e093b.tar.gz |
cbs: Always check for bitstream end before reading
Diffstat (limited to 'libavcodec/cbs.c')
-rw-r--r-- | libavcodec/cbs.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index 10943164da..7440914939 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -313,6 +313,12 @@ int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, BitstreamContext *bc, av_assert0(width <= 32); + if (bitstream_bits_left(bc) < width) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid value at " + "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } + if (ctx->trace_enable) position = bitstream_tell(bc); |