summaryrefslogtreecommitdiff
path: root/libavcodec/tta.c
diff options
context:
space:
mode:
authorShitiz Garg <mail@dragooon.net>2011-12-11 01:10:57 +0530
committerJustin Ruggles <justin.ruggles@gmail.com>2011-12-10 14:54:19 -0500
commit8bd1f1a4c8e591e92e7f4933a89fe5de72e5563f (patch)
treee0014e5f15e44fda71bbadd66b5dc0e04d6d1f00 /libavcodec/tta.c
parent7d18d17abd9dadca1d717a7ace76bd611b7a289c (diff)
ttadec: check channel count as read from extradata.
fixes floating-point exception due to channels being set to 0. fixes Bug 128. Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
Diffstat (limited to 'libavcodec/tta.c')
-rw-r--r--libavcodec/tta.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index 6b76f527c4..c8d58fd9ec 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -221,6 +221,11 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
s->data_length = get_bits_long(&s->gb, 32);
skip_bits(&s->gb, 32); // CRC32 of header
+ if (s->channels == 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid number of channels\n");
+ return AVERROR_INVALIDDATA;
+ }
+
switch(s->bps) {
case 2:
avctx->sample_fmt = AV_SAMPLE_FMT_S16;