summaryrefslogtreecommitdiff
path: root/libavcodec/hevc_cabac.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-01-15 23:46:44 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2018-01-27 04:29:30 +0100
commita026a3efaeb9c2026668dccbbda339a21ab3206b (patch)
tree5ec494ccaa52af6be31fa08f6136e28c4fb2e213 /libavcodec/hevc_cabac.c
parent1bfc1aa004950c5ad527d823a08b8a19eef34eb0 (diff)
avcodec/hevc_cabac: Check prefix so as to avoid invalid shifts in coeff_abs_level_remaining_decode()
I suspect that this can be limited tighter, but i failed to find anything in the spec that would confirm that. Fixes: 4833/clusterfuzz-testcase-minimized-5302840101699584 Fixes: runtime error: left shift of 134217730 by 4 places cannot be represented in type 'int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg 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 743168500c..faa36d5459 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) {
+ if (prefix == CABAC_MAX_BIN || prefix_minus3 + rc_rice_param >= 31) {
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix);
return 0;
}