[FFmpeg-devel] [PATCH 1/6] avcodec/cbs: sei_3d_reference_displays_info uses length 0 elements

Michael Niedermayer michael at niedermayer.cc
Wed Jul 31 22:54:05 EEST 2024


Fixes: 70458/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5259339779080192
Fixes: Assertion width > 0 && width <= 32 failed at libavcodec/cbs.c:608

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/cbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index b26e39eab4d..dcbc86a5f7d 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -605,7 +605,7 @@ static av_always_inline int cbs_read_unsigned(CodedBitstreamContext *ctx,
 
     CBS_TRACE_READ_START();
 
-    av_assert0(width > 0 && width <= 32);
+    av_assert0(width >= 0 && width <= 32);
 
     if (get_bits_left(gbc) < width) {
         av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid value at "
-- 
2.45.2



More information about the ffmpeg-devel mailing list