mirror of https://git.ffmpeg.org/ffmpeg.git
wmavoice: validate block alignment
This prevents a division by zero crash in wmavoice_decode_packet.
The problem was introduced by commit
3deb4b54a2
.
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
parent
91e6a64d2e
commit
e8651f51aa
|
@ -388,6 +388,11 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
|
||||||
ctx->extradata_size);
|
ctx->extradata_size);
|
||||||
return AVERROR_INVALIDDATA;
|
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);
|
flags = AV_RL32(ctx->extradata + 18);
|
||||||
s->spillover_bitsize = 3 + av_ceil_log2(ctx->block_align);
|
s->spillover_bitsize = 3 + av_ceil_log2(ctx->block_align);
|
||||||
s->do_apf = flags & 0x1;
|
s->do_apf = flags & 0x1;
|
||||||
|
|
Loading…
Reference in New Issue