[FFmpeg-devel] [PATCH v1 01/10] return value check for init_get_bits in wmv2dec.c

maryam ebrahimzadeh me22bee at outlook.com
Thu Aug 12 07:48:01 EEST 2021


As the second argument for init_get_bits can be crafted, a return value check for this function call is necessary  so replace init_get_bits with init_get_bits8.

---
 libavcodec/wmv2dec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
index c500e3e779..73da73c02c 100644
--- a/libavcodec/wmv2dec.c
+++ b/libavcodec/wmv2dec.c
@@ -101,12 +101,14 @@ static int decode_ext_header(Wmv2Context *w)
     GetBitContext gb;
     int fps;
     int code;
+    int ret;
 
     if (s->avctx->extradata_size < 4)
         return AVERROR_INVALIDDATA;
 
-    init_get_bits(&gb, s->avctx->extradata, 32);
-
+    ret = init_get_bits8(&gb, s->avctx->extradata, 4);
+    if (ret < 0)
+        return ret;
     fps                 = get_bits(&gb, 5);
     s->bit_rate         = get_bits(&gb, 11) * 1024;
     w->mspel_bit        = get_bits1(&gb);
-- 
2.17.1



More information about the ffmpeg-devel mailing list