[FFmpeg-cvslog] avcodec/scpr3: Check add_dec() for failure
Michael Niedermayer
git at videolan.org
Fri Jun 14 22:20:46 EEST 2024
ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Thu May 16 21:16:00 2024 +0200| [86a2543744fa20c21b2fc5cb29e52ed40eb2c4fa] | committer: Michael Niedermayer
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 at niedermayer.cc>
(cherry picked from commit d741638042d827aed994b819857d6587121627ab)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86a2543744fa20c21b2fc5cb29e52ed40eb2c4fa
---
libavcodec/scpr3.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavcodec/scpr3.c b/libavcodec/scpr3.c
index f56ae19118..e45f56ebcc 100644
--- a/libavcodec/scpr3.c
+++ b/libavcodec/scpr3.c
@@ -466,6 +466,8 @@ static int decode_adaptive6(PixelModel3 *m, uint32_t code, uint32_t *value,
return 0;
grow_dec(m);
c = add_dec(m, q, g, f);
+ if (c < 0)
+ return AVERROR_INVALIDDATA;
}
incr_cntdec(m, c);
@@ -885,11 +887,11 @@ static int decode_unit3(SCPRContext *s, PixelModel3 *m, uint32_t code, uint32_t
sync_code3(gb, rc);
break;
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);
- if (ret < 0)
- return AVERROR_INVALIDDATA;
- }
+ if (ret < 0)
+ return ret;
decode3(gb, rc, a, b);
sync_code3(gb, rc);
break;
More information about the ffmpeg-cvslog
mailing list