diff mbox

[FFmpeg-devel] avcodec/wmavoice: sanity check block_align

Message ID 20191222150636.17446-1-michael@niedermayer.cc
State Accepted
Headers show

Commit Message

Michael Niedermayer Dec. 22, 2019, 3:06 p.m. UTC
This limit is roughly based on the bitreader limit, its likely a much tighter limit
could be used

Fixes: left shift of 1965039647 by 1 places cannot be represented in type 'int'
Fixes: 19545/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-5695391899320320

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

Comments

Michael Niedermayer Feb. 2, 2020, 10:54 p.m. UTC | #1
On Sun, Dec 22, 2019 at 04:06:36PM +0100, Michael Niedermayer wrote:
> This limit is roughly based on the bitreader limit, its likely a much tighter limit
> could be used
> 
> Fixes: left shift of 1965039647 by 1 places cannot be represented in type 'int'
> Fixes: 19545/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAVOICE_fuzzer-5695391899320320
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/wmavoice.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index c61ecfbe3b..f6550c6a71 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -386,7 +386,7 @@  static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
                ctx->extradata_size);
         return AVERROR_INVALIDDATA;
     }
-    if (ctx->block_align <= 0) {
+    if (ctx->block_align <= 0 || ctx->block_align > (1<<22)) {
         av_log(ctx, AV_LOG_ERROR, "Invalid block alignment %d.\n", ctx->block_align);
         return AVERROR_INVALIDDATA;
     }