]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/hevc_cabac: Check prefix so as to avoid invalid shifts in coeff_abs_level_rem...
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 15 Jan 2018 22:46:44 +0000 (23:46 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 27 Jan 2018 03:29:30 +0000 (04:29 +0100)
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>
libavcodec/hevc_cabac.c

index 743168500c7b8767727c8aac00800a55513ec480..faa36d545935f4a15fd220fb614389533089c891 100644 (file)
@@ -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;
         }