aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-09-19 16:29:15 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:19 +0200
commit76109b1ac349bdb59c379aa6a6bdc6df8dba36ee (patch)
tree0f4ff4be98f9a0f29750e48434458bde31e262fd /libavcodec
parent3f13007d5c1befab7182a0db50ac180f4d231036 (diff)
downloadffmpeg-76109b1ac349bdb59c379aa6a6bdc6df8dba36ee.tar.gz
avcodec/hevcdec: Check slice_cb_qp_offset / slice_cr_qp_offset
Fixes: signed integer overflow: 29 + 2147483640 cannot be represented in type 'int' Fixes: 25413/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5697909331591168 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 106f11f68af643ad1f372b840d38a0a30c6e9bcf) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/hevc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 4be7894ae7..85122eb056 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -703,6 +703,11 @@ static int hls_slice_header(HEVCContext *s)
if (s->ps.pps->pic_slice_level_chroma_qp_offsets_present_flag) {
sh->slice_cb_qp_offset = get_se_golomb(gb);
sh->slice_cr_qp_offset = get_se_golomb(gb);
+ if (sh->slice_cb_qp_offset < -12 || sh->slice_cb_qp_offset > 12 ||
+ sh->slice_cr_qp_offset < -12 || sh->slice_cr_qp_offset > 12) {
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid slice cx qp offset.\n");
+ return AVERROR_INVALIDDATA;
+ }
} else {
sh->slice_cb_qp_offset = 0;
sh->slice_cr_qp_offset = 0;