[FFmpeg-devel] [PATCH v1 09/10] return value check for init_get_bits in vaapi_mpeg2.c
maryam ebrahimzadeh
me22bee at outlook.com
Thu Aug 12 07:54:35 EEST 2021
---
libavcodec/vaapi_mpeg2.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
index 26e0cd827c..8e3903212a 100644
--- a/libavcodec/vaapi_mpeg2.c
+++ b/libavcodec/vaapi_mpeg2.c
@@ -136,9 +136,12 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
GetBitContext gb;
uint32_t quantiser_scale_code, intra_slice_flag, macroblock_offset;
int err;
+ int ret;
/* Determine macroblock_offset */
- init_get_bits(&gb, buffer, 8 * size);
+ ret = init_get_bits8(&gb, buffer, size);
+ if (ret < 0 )
+ return ret;
if (get_bits_long(&gb, 32) >> 8 != 1) /* start code */
return AVERROR_INVALIDDATA;
quantiser_scale_code = get_bits(&gb, 5);
--
2.17.1
More information about the ffmpeg-devel
mailing list