[FFmpeg-cvslog] avcodec/cbs_h2645: Fix showing bits at the end in cbs_read_se_golomb()

Michael Niedermayer git at videolan.org
Mon Oct 16 03:25:55 EEST 2023


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Oct  5 18:14:56 2023 +0200| [61b86add52fa6af4fb872894a349e24b5fcb98d2] | committer: Michael Niedermayer

avcodec/cbs_h2645: Fix showing bits at the end in cbs_read_se_golomb()

Fixes: Assertion n>0 && n<=25 failed at libavcodec/get_bits.h:375
Fixes: 62618/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_REDUNDANT_PPS_fuzzer-5145745046765568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61b86add52fa6af4fb872894a349e24b5fcb98d2
---

 libavcodec/cbs_h2645.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index adf9c16fdf..470f60b95f 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -94,7 +94,7 @@ static int cbs_read_se_golomb(CodedBitstreamContext *ctx, GetBitContext *gbc,
 
     max_length = FFMIN(get_bits_left(gbc), 32);
 
-    leading_bits = show_bits_long(gbc, max_length);
+    leading_bits = max_length ? show_bits_long(gbc, max_length) : 0;
     if (leading_bits == 0) {
         if (max_length >= 32) {
             av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid se-golomb code at "



More information about the ffmpeg-cvslog mailing list