aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2017-01-01 22:48:38 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2017-01-03 00:52:55 +0100
commite8651f51aa46268613b328c60079e16d992e013f (patch)
treefd8c214f958f18818441a6adf2ccfd82ebc989b7
parent91e6a64d2ea62edbe1178a65a2376e605f6988d5 (diff)
downloadffmpeg-e8651f51aa46268613b328c60079e16d992e013f.tar.gz
wmavoice: validate block alignment
This prevents a division by zero crash in wmavoice_decode_packet. The problem was introduced by commit 3deb4b54a24f8cddce463d9f5751b01efeb976af. Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r--libavcodec/wmavoice.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index c310b19a70..c2390a92b6 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -388,6 +388,11 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
ctx->extradata_size);
return AVERROR_INVALIDDATA;
}
+ if (ctx->block_align <= 0) {
+ av_log(ctx, AV_LOG_ERROR, "Invalid block alignment %d.\n", ctx->block_align);
+ return AVERROR_INVALIDDATA;
+ }
+
flags = AV_RL32(ctx->extradata + 18);
s->spillover_bitsize = 3 + av_ceil_log2(ctx->block_align);
s->do_apf = flags & 0x1;