From 7416d610362807848236ceff1bc6740dbc82842d Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Fri, 10 Feb 2012 10:51:43 -0800 Subject: [PATCH] tta: error out if samplerate is zero. Prevents a division by zero later on. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org --- libavcodec/tta.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 853f6a2aae..28d0e9b7e9 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -223,6 +223,9 @@ static av_cold int tta_decode_init(AVCodecContext * avctx) if (s->channels == 0) { av_log(s->avctx, AV_LOG_ERROR, "Invalid number of channels\n"); return AVERROR_INVALIDDATA; + } else if (avctx->sample_rate == 0) { + av_log(s->avctx, AV_LOG_ERROR, "Invalid samplerate\n"); + return AVERROR_INVALIDDATA; } switch(s->bps) {