aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-07-05 02:21:51 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-07-12 22:42:35 +0200
commitb9899866418cb3bd930846271470e3096917f5f6 (patch)
tree88921ccc4bbc717f8202f909d5bf27c0498ad022
parent0e3e7e8aeb4448a355979ddec87b0e1676ca9f15 (diff)
downloadffmpeg-b9899866418cb3bd930846271470e3096917f5f6.tar.gz
avcodec/loco: check get_ur_golomb_jpegls() for failure
Fixes: CID1604400 Overflowed constant Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/loco.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/loco.c b/libavcodec/loco.c
index b1294a9798..4aba1eb9c5 100644
--- a/libavcodec/loco.c
+++ b/libavcodec/loco.c
@@ -92,10 +92,15 @@ static inline int loco_get_rice(RICEContext *r)
if (get_bits_left(&r->gb) < 1)
return INT_MIN;
v = get_ur_golomb_jpegls(&r->gb, loco_get_rice_param(r), INT_MAX, 0);
+ if (v == -1)
+ return INT_MIN;
loco_update_rice_param(r, (v + 1) >> 1);
if (!v) {
if (r->save >= 0) {
- r->run = get_ur_golomb_jpegls(&r->gb, 2, INT_MAX, 0);
+ int run = get_ur_golomb_jpegls(&r->gb, 2, INT_MAX, 0);
+ if (run == -1)
+ return INT_MIN;
+ r->run = run;
if (r->run > 1)
r->save += r->run + 1;
else