[FFmpeg-devel] [PATCH 1/4] avcodec/notchlc: Check init_get_bits8() for failure

Michael Niedermayer michael at niedermayer.cc
Mon May 13 04:20:08 EEST 2024


Fixes: CID1500300 Unchecked return value

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

diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c
index 6dd3f884407..30427f4ba92 100644
--- a/libavcodec/notchlc.c
+++ b/libavcodec/notchlc.c
@@ -243,7 +243,9 @@ static int decode_blocks(AVCodecContext *avctx, AVFrame *p,
 
         bytestream2_seek(&dgb, s->y_data_offset + row_offset, SEEK_SET);
 
-        init_get_bits8(&bit, dgb.buffer, bytestream2_get_bytes_left(&dgb));
+        ret = init_get_bits8(&bit, dgb.buffer, bytestream2_get_bytes_left(&dgb));
+        if (ret < 0)
+            return ret;
         for (int x = 0; x < avctx->width; x += 4) {
             unsigned item = bytestream2_get_le32(gb);
             unsigned y_min = item & 4095;
-- 
2.43.2



More information about the ffmpeg-devel mailing list