From b3a9f2dfbf2876231870bdbfc7c55c9b92fdd91a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 24 Nov 2020 00:22:39 +0100 Subject: [PATCH] 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 (cherry picked from commit 0a7c648e2d85a59975cc88079975cf9f3306ed0a) Signed-off-by: Michael Niedermayer --- libavformat/wavdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index e5a2f00814..119ef6f1a0 100644 --- a/libavformat/wavdec.c +++ b/libavformat/wavdec.c @@ -72,7 +72,7 @@ static void set_spdif(AVFormatContext *s, WAVDemuxContext *wav) if (ret < 0) goto end; - buf = av_malloc(len); + buf = av_malloc(len + AV_INPUT_BUFFER_PADDING_SIZE); if (!buf) { ret = AVERROR(ENOMEM); goto end;