xmv: check channel number

Fixes FPE

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-03-23 10:31:45 +01:00
parent 08c37a10e9
commit 5934d57ba9

View File

@ -183,6 +183,11 @@ static int xmv_read_header(AVFormatContext *s)
packet->bits_per_sample = avio_rl16(pb);
packet->flags = avio_rl16(pb);
if (!packet->channels) {
av_log(s, AV_LOG_ERROR, "0 channels\n");
return AVERROR(EINVAL);
}
packet->bit_rate = packet->bits_per_sample *
packet->sample_rate *
packet->channels;