---
 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

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to