aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-21 23:22:05 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-06 15:03:15 +0100
commit7f4c5ede99a374af011631c9bcf9db8f181ee618 (patch)
treefd33c27b0e362e0aa4aa752ddd35a5feb596e5f4
parent5a485d052a5ac5440334db3fe4153cce283bd808 (diff)
downloadffmpeg-7f4c5ede99a374af011631c9bcf9db8f181ee618.tar.gz
avcodec/sonic: Check e in get_symbol()
Fixes: signed integer overflow: 1721520852 + 1721520852 cannot be represented in type 'int' Fixes: 18346/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5709623893426176 Fixes: 18753/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5663299131932672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit aea67556116330d3151e4cd3ef1e266b5d90f388) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/sonic.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index 953c70fcd4..1b16825403 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -144,6 +144,8 @@ static inline av_flatten int get_symbol(RangeCoder *c, uint8_t *state, int is_si
e= 0;
while(get_rac(c, state+1 + FFMIN(e,9))){ //1..10
e++;
+ if (e > 31)
+ return AVERROR_INVALIDDATA;
}
a= 1;