summaryrefslogtreecommitdiff
path: root/libavcodec/cbs_h264_syntax_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-03-22 16:38:24 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 13:33:44 +0200
commit9342a639a770ff27248cdb76297d8b9357715f5c (patch)
treef6682dbbab5c8eafd8a81067ca48f74f08faf0f0 /libavcodec/cbs_h264_syntax_template.c
parent531b3300a7c1d0639dbcacbd55552ff4d56f4f6e (diff)
downloadffmpeg-9342a639a770ff27248cdb76297d8b9357715f5c.tar.gz
avcodec/cbs_h264_syntax_template: fix off by 1 error with slice_group_change_cycle
Fixes: assertion failure Fixes: 20390/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_REDUNDANT_PPS_fuzzer-5683400772157440 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 741565a1e69c45ce4848f01e45be5e66a68efa2f) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/cbs_h264_syntax_template.c')
-rw-r--r--libavcodec/cbs_h264_syntax_template.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
index 29089e4b6c..df934b2679 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -1240,7 +1240,7 @@ static int FUNC(slice_header)(CodedBitstreamContext *ctx, RWContext *rw,
(sps->pic_height_in_map_units_minus1 + 1);
max = (pic_size + pps->slice_group_change_rate_minus1) /
(pps->slice_group_change_rate_minus1 + 1);
- bits = av_log2(2 * max - 1);
+ bits = av_ceil_log2(max + 1);
u(bits, slice_group_change_cycle, 0, max);
}