diff mbox series

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

Message ID 20240705002156.1964272-11-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,01/15] avcodec/xsubdec: Check parse_timecode() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer July 5, 2024, 12:21 a.m. UTC
Fixes: CID1604495 Overflowed constant

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

Patch

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++) {