User-provided data should never trigger an assert; also fixes the warning:
libavcodec/vaapi_mpeg2.c:112:14: warning: variable 'start_code' set but not used
---
 libavcodec/vaapi_mpeg2.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
index 561f4bf..b162e33 100644
--- a/libavcodec/vaapi_mpeg2.c
+++ b/libavcodec/vaapi_mpeg2.c
@@ -116,7 +116,8 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, 
const uint8_t *buffer
     /* Determine macroblock_offset */
     init_get_bits(&gb, buffer, 8 * size);
     start_code = get_bits(&gb, 32);
-    assert((start_code & 0xffffff00) == 0x00000100);
+    if ((start_code & 0xffffff00) == 0x00000100)
+        return -1;
     quantiser_scale_code = get_bits(&gb, 5);
     intra_slice_flag = get_bits1(&gb);
     if (intra_slice_flag) {
-- 
1.7.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to