summaryrefslogtreecommitdiff
path: root/libavcodec/hevc_cabac.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-23 00:24:01 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:53:29 +0200
commitbb81e6eb55bc4ce702b8926dd3d32f9b3c202520 (patch)
tree561c6f4cd0cd94cb0876dcdb223e0a73dbcafaa5 /libavcodec/hevc_cabac.c
parent44e692bb0a54d39b08bdbb2c0692bf1a06592194 (diff)
downloadffmpeg-bb81e6eb55bc4ce702b8926dd3d32f9b3c202520.tar.gz
avcodec/hevc_cabac: Limit value in coeff_abs_level_remaining_decode() tighter
The max depth is 16bps, the max allowed coefficient depth is depth+6 Fixes: signed integer overflow: 1074266112 + 1073725439 cannot be represented in type 'int' Fixes: 26493/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5657763331702784 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 7cf852b03c3ae6b61f89614371d2cb308d0b7f86) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/hevc_cabac.c')
-rw-r--r--libavcodec/hevc_cabac.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/hevc_cabac.c b/libavcodec/hevc_cabac.c
index 8abb780dd7..12fc9f9fdc 100644
--- a/libavcodec/hevc_cabac.c
+++ b/libavcodec/hevc_cabac.c
@@ -998,7 +998,7 @@ static av_always_inline int coeff_abs_level_remaining_decode(HEVCContext *s, int
} else {
int prefix_minus3 = prefix - 3;
- if (prefix == CABAC_MAX_BIN || prefix_minus3 + rc_rice_param >= 31) {
+ if (prefix == CABAC_MAX_BIN || prefix_minus3 + rc_rice_param > 16 + 6) {
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix);
return 0;
}