avcodec/hevc_cabac: Fix integer overflow in ff_hevc_cu_qp_delta_abs()

Fixes: signed integer overflow: 2147483647 + 1073741824 cannot be represented in type 'int'
Fixes: 4555/clusterfuzz-testcase-minimized-4505532481142784

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 0ee143558d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2017-12-15 18:17:13 +01:00
parent a3df874b5a
commit 2ce4f01d59
1 changed files with 3 additions and 1 deletions

View File

@ -685,8 +685,10 @@ int ff_hevc_cu_qp_delta_abs(HEVCContext *s)
suffix_val += 1 << k; suffix_val += 1 << k;
k++; k++;
} }
if (k == CABAC_MAX_BIN) if (k == CABAC_MAX_BIN) {
av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k); av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k);
return AVERROR_INVALIDDATA;
}
while (k--) while (k--)
suffix_val += get_cabac_bypass(&s->HEVClc->cc) << k; suffix_val += get_cabac_bypass(&s->HEVClc->cc) << k;