[FFmpeg-devel] [PATCH 09/15] avcodec/leaddec: Check init_get_bits8() for failure

Michael Niedermayer michael at niedermayer.cc
Fri Jul 5 03:21:50 EEST 2024


Fixes: CID1604416 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/leaddec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/leaddec.c b/libavcodec/leaddec.c
index 947c7275bec..2f5152c2261 100644
--- a/libavcodec/leaddec.c
+++ b/libavcodec/leaddec.c
@@ -194,7 +194,9 @@ static int lead_decode_frame(AVCodecContext *avctx, AVFrame * frame,
             i++;
     }
 
-    init_get_bits8(&gb, s->bitstream_buf, size);
+    ret = init_get_bits8(&gb, s->bitstream_buf, size);
+    if (ret < 0)
+        return ret;
 
     if (avctx->pix_fmt == AV_PIX_FMT_YUV420P && zero) {
         for (int mb_y = 0; mb_y < avctx->height / 8; mb_y++)
-- 
2.45.2



More information about the ffmpeg-devel mailing list