From 9e9e6bbe7b79cf7bb628b7f32321b9509ecb3cba Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 29 May 2012 19:16:22 +0200 Subject: [PATCH] 4xm: fix division by zero caused by bps<8 Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 1b8741a6843f3f4667c81c2d63d3182858aa534f) Signed-off-by: Michael Niedermayer --- libavformat/4xm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 90a5fa0cbb..c8eb0c0d1f 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -201,6 +201,11 @@ static int fourxm_read_header(AVFormatContext *s, ret= -1; goto fail; } + if(!fourxm->tracks[current_track].adpcm && fourxm->tracks[current_track].bits<8){ + av_log(s, AV_LOG_ERROR, "bits unspecified for non ADPCM\n"); + ret = AVERROR_INVALIDDATA; + goto fail; + } i += 8 + size; /* allocate a new AVStream */