mirror of https://git.ffmpeg.org/ffmpeg.git
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>
(cherry picked from commit b989986641
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
a08d5d9c20
commit
1a0f4df41b
|
@ -91,10 +91,15 @@ static inline int loco_get_rice(RICEContext *r)
|
||||||
if (get_bits_left(&r->gb) < 1)
|
if (get_bits_left(&r->gb) < 1)
|
||||||
return INT_MIN;
|
return INT_MIN;
|
||||||
v = get_ur_golomb_jpegls(&r->gb, loco_get_rice_param(r), INT_MAX, 0);
|
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);
|
loco_update_rice_param(r, (v + 1) >> 1);
|
||||||
if (!v) {
|
if (!v) {
|
||||||
if (r->save >= 0) {
|
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)
|
if (r->run > 1)
|
||||||
r->save += r->run + 1;
|
r->save += r->run + 1;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue