[FFmpeg-cvslog] avformat/wavdec: Consider AV_INPUT_BUFFER_PADDING_SIZE in set_spdif()

Michael Niedermayer git at videolan.org
Wed Feb 10 22:30:38 EET 2021


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Nov 24 00:22:39 2020 +0100| [0a7c648e2d85a59975cc88079975cf9f3306ed0a] | committer: Michael Niedermayer

avformat/wavdec: Consider AV_INPUT_BUFFER_PADDING_SIZE in set_spdif()

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 at niedermayer.cc>

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

 libavformat/wavdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 256c36ebe2..ef144502a2 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -71,7 +71,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 {



More information about the ffmpeg-cvslog mailing list