1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/scpr3: Check add_dec() for failure

Fixes: CID1441459 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-05-16 21:16:00 +02:00
parent e5098589b0
commit d741638042
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -465,6 +465,8 @@ static int decode_adaptive6(PixelModel3 *m, uint32_t code, uint32_t *value,
return 0; return 0;
grow_dec(m); grow_dec(m);
c = add_dec(m, q, g, f); c = add_dec(m, q, g, f);
if (c < 0)
return AVERROR_INVALIDDATA;
} }
incr_cntdec(m, c); incr_cntdec(m, c);
@ -868,11 +870,11 @@ static int decode_unit3(SCPRContext *s, PixelModel3 *m, uint32_t code, uint32_t
sync_code3(gb, rc); sync_code3(gb, rc);
break; break;
case 6: case 6:
if (!decode_adaptive6(m, code, value, &a, &b)) { ret = decode_adaptive6(m, code, value, &a, &b);
if (!ret)
ret = update_model6_to_7(m); ret = update_model6_to_7(m);
if (ret < 0) if (ret < 0)
return AVERROR_INVALIDDATA; return ret;
}
decode3(gb, rc, a, b); decode3(gb, rc, a, b);
sync_code3(gb, rc); sync_code3(gb, rc);
break; break;