[FFmpeg-devel] [PATCH 11/15] avcodec/loco: Check loco_get_rice() for failure

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


Fixes: CID1604495 Overflowed constant

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

diff --git a/libavcodec/loco.c b/libavcodec/loco.c
index 4aba1eb9c52..d73d8fa88bb 100644
--- a/libavcodec/loco.c
+++ b/libavcodec/loco.c
@@ -157,6 +157,8 @@ static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int heigh
 
     /* restore top left pixel */
     val     = loco_get_rice(&rc);
+    if (val == INT_MIN)
+        return AVERROR_INVALIDDATA;
     data[0] = 128 + val;
     /* restore top line */
     for (i = 1; i < width; i++) {
-- 
2.45.2



More information about the ffmpeg-devel mailing list