diff mbox series

[FFmpeg-devel,3/3] avformat/wavdec: Consider AV_INPUT_BUFFER_PADDING_SIZE in set_spdif()

Message ID 20201123234204.24194-3-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/3] avformat/flvdec: Treat high ts byte as unsigned
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer Nov. 23, 2020, 11:42 p.m. UTC
The buffer is read by using the bit reader
Fixes: out of array read
Fixes: 27539/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-5650565572591616

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

Patch

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index df6030a42d..ef25544b1d 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -72,7 +72,7 @@  static void set_spdif(AVFormatContext *s, WAVDemuxContext *wav)
         int ret = ffio_ensure_seekback(s->pb, len);
 
         if (ret >= 0) {
-            uint8_t *buf = av_malloc(len);
+            uint8_t *buf = av_malloc(len + AV_INPUT_BUFFER_PADDING_SIZE);
             if (!buf) {
                 ret = AVERROR(ENOMEM);
             } else {