diff mbox series

[FFmpeg-devel,2/2] avformat/wavdec: Check that smv block fits in available space

Message ID 20230305114346.19875-2-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/2] avcodec/rka: use 64bit for srate_pad computation | expand

Commit Message

Michael Niedermayer March 5, 2023, 11:43 a.m. UTC
Fixes: OOM
Fixes: 56271/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-5290810045497344

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 | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index e3f790fcc9..97e69ab2ee 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -730,6 +730,10 @@  smv_retry:
                 goto smv_out;
             }
             size = avio_rl24(s->pb);
+            if (size > wav->smv_block_size) {
+                ret = AVERROR_EOF;
+                goto smv_out;
+            }
             ret  = av_get_packet(s->pb, pkt, size);
             if (ret < 0)
                 goto smv_out;