From 5934d57ba99b3dab4dfe98472ac6b30b9cf6329a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 23 Mar 2012 10:31:45 +0100 Subject: [PATCH] xmv: check channel number Fixes FPE Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavformat/xmv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/xmv.c b/libavformat/xmv.c index 110103ea69..596da5fb63 100644 --- a/libavformat/xmv.c +++ b/libavformat/xmv.c @@ -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;