diff mbox series

[FFmpeg-devel,13/15] avformat/xwma: sanity check bits_per_coded_sample

Message ID 20230930223046.22896-13-michael@niedermayer.cc
State Accepted
Commit fe6ce28d118d6030984e1ee5c2d92e98514fe3d1
Headers show
Series [FFmpeg-devel,01/15] avformat/concatdec: Check in/outpoint for overflow | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Sept. 30, 2023, 10:30 p.m. UTC
Fixes: signed integer overflow: 65312 * 524296 cannot be represented in type 'int'
Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_dem_XWMA_fuzzer-6595971445555200

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

Patch

diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index 12689f37fd7..b830f9ed75f 100644
--- a/libavformat/xwma.c
+++ b/libavformat/xwma.c
@@ -151,7 +151,7 @@  static int xwma_read_header(AVFormatContext *s)
                st->codecpar->ch_layout.nb_channels);
         return AVERROR_INVALIDDATA;
     }
-    if (!st->codecpar->bits_per_coded_sample) {
+    if (!st->codecpar->bits_per_coded_sample || st->codecpar->bits_per_coded_sample > 64) {
         av_log(s, AV_LOG_WARNING, "Invalid bits_per_coded_sample: %d\n",
                st->codecpar->bits_per_coded_sample);
         return AVERROR_INVALIDDATA;