aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-05-17 22:14:56 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-05-19 11:49:33 +0200
commita7e506fcd8442ee432ae1450ccc4ce212b5c2e1e (patch)
tree1b32e8d06652472f4a72cf91d6c8bc754c83b141
parent95937d6316310015187cbad371b58f54653a9ed1 (diff)
downloadffmpeg-a7e506fcd8442ee432ae1450ccc4ce212b5c2e1e.tar.gz
avcodec/vc1_parser: Check init_get_bits8()
Addresses Coverity issue #1441935. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/vc1_parser.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index ec284dca00..a536a7bcf8 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -26,6 +26,7 @@
*/
#include "libavutil/attributes.h"
+#include "libavutil/avassert.h"
#include "parser.h"
#include "vc1.h"
#include "get_bits.h"
@@ -66,7 +67,9 @@ static void vc1_extract_header(AVCodecParserContext *s, AVCodecContext *avctx,
GetBitContext gb;
int ret;
vpc->v.s.avctx = avctx;
- init_get_bits8(&gb, buf, buf_size);
+ ret = init_get_bits8(&gb, buf, buf_size);
+ av_assert1(ret >= 0); // buf_size is bounded by UNESCAPED_THRESHOLD
+
switch (vpc->prev_start_code) {
case VC1_CODE_SEQHDR & 0xFF:
ff_vc1_decode_sequence_header(avctx, &vpc->v, &gb);