[FFmpeg-cvslog] avcodec/avs2_parser: Assert init_get_bits8() success with const size 15

Michael Niedermayer git at videolan.org
Sat May 25 01:56:38 EEST 2024


ffmpeg | branch: release/6.1 | Michael Niedermayer <michael at niedermayer.cc> | Wed May  1 15:50:56 2024 +0200| [e886fe5542cd3bd5de47c54bd31a7d5a398d5571] | committer: Michael Niedermayer

avcodec/avs2_parser: Assert init_get_bits8() success with const size 15

Fixes: CID1506708 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit a7c4f119c91bcb3791a3c242ee61a5c60379db4f)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e886fe5542cd3bd5de47c54bd31a7d5a398d5571
---

 libavcodec/avs2_parser.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
index 200134f91d..0d68ab1d00 100644
--- a/libavcodec/avs2_parser.c
+++ b/libavcodec/avs2_parser.c
@@ -72,13 +72,15 @@ static void parse_avs2_seq_header(AVCodecParserContext *s, const uint8_t *buf,
     unsigned aspect_ratio;
     unsigned frame_rate_code;
     int low_delay;
+    av_unused int ret;
     // update buf_size_min if parse more deeper
     const int buf_size_min = 15;
 
     if (buf_size < buf_size_min)
         return;
 
-    init_get_bits8(&gb, buf, buf_size_min);
+    ret = init_get_bits8(&gb, buf, buf_size_min);
+    av_assert1(ret >= 0);
 
     s->key_frame = 1;
     s->pict_type = AV_PICTURE_TYPE_I;



More information about the ffmpeg-cvslog mailing list