[FFmpeg-devel] [PATCH 6/7] avcodec/get_bits: dont add a null to a 0
Michael Niedermayer
michael at niedermayer.cc
Tue Sep 24 00:32:48 EEST 2024
Fixes: undefined behavior
Fixes: 71747/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5427736120721408
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/get_bits.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index fe2f6378b45..beeff87a79b 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -528,7 +528,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
s->buffer = buffer;
s->size_in_bits = bit_size;
s->size_in_bits_plus8 = bit_size + 8;
- s->buffer_end = buffer + buffer_size;
+ s->buffer_end = buffer ? buffer + buffer_size : NULL;
s->index = 0;
return ret;
--
2.46.1
More information about the ffmpeg-devel
mailing list