aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-03-22 16:38:24 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-03 12:10:24 +0200
commitf49374b47d82db83f0cbb8682ba354e095b174dd (patch)
treed1f2a05d53f76b2213b7a8d5095ea024048c8815
parent0a308576bf83db4c5c1728b634b951a7ce6f9b54 (diff)
downloadffmpeg-f49374b47d82db83f0cbb8682ba354e095b174dd.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>
-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 57fc02082c..6a14b55708 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -1355,7 +1355,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);
}