[FFmpeg-cvslog] avformat/wavdec: sanity check channels and bps before using them for block_align
Michael Niedermayer
git at videolan.org
Sun Apr 14 04:44:39 EEST 2024
ffmpeg | branch: release/6.1 | Michael Niedermayer <michael at niedermayer.cc> | Tue Mar 26 00:45:09 2024 +0100| [6d92f9a85eb17435f7a6fcdfa19dee2d82ceedb4] | committer: Michael Niedermayer
avformat/wavdec: sanity check channels and bps before using them for block_align
Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-4704044498944000
Fixes: signed integer overflow: 520464 * 8224 cannot be represented in type 'int'
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 75317ec4420d9853526291e8aa18f3ea17321525)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6d92f9a85eb17435f7a6fcdfa19dee2d82ceedb4
---
libavformat/wavdec.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 0c6629b157..a4afbc11fd 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -34,6 +34,7 @@
#include "libavutil/log.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
+#include "libavcodec/internal.h"
#include "avformat.h"
#include "avio.h"
#include "avio_internal.h"
@@ -899,7 +900,9 @@ static int w64_read_header(AVFormatContext *s)
if (ret < 0)
return ret;
avio_skip(pb, FFALIGN(size, INT64_C(8)) - size);
- if (st->codecpar->block_align) {
+ if (st->codecpar->block_align &&
+ st->codecpar->ch_layout.nb_channels < FF_SANE_NB_CHANNELS &&
+ st->codecpar->bits_per_coded_sample < 128) {
int block_align = st->codecpar->block_align;
block_align = FFMAX(block_align,
More information about the ffmpeg-cvslog
mailing list