summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2013-06-25 22:24:55 +0000
committerPaul B Mahol <onemda@gmail.com>2013-06-25 22:24:55 +0000
commitad194b04879cb5c1b489d2453517228cf15eb4e8 (patch)
tree12d4edc25f8e379ec8deffd5269df6afd3f9a55a /libavformat
parentda8c9b324c7b47a95edb35320b66d0c409bb6de5 (diff)
xa: abort if number of channels or sample rate is 0
Fixes #2711. Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/xa.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/xa.c b/libavformat/xa.c
index 437de3f433..43661dea43 100644
--- a/libavformat/xa.c
+++ b/libavformat/xa.c
@@ -84,6 +84,9 @@ static int xa_read_header(AVFormatContext *s)
avio_skip(pb, 2); /* Skip block align */
avio_skip(pb, 2); /* Skip bits-per-sample */
+ if (!st->codec->channels || !st->codec->sample_rate)
+ return AVERROR_INVALIDDATA;
+
st->codec->bit_rate = av_clip(15LL * st->codec->channels * 8 *
st->codec->sample_rate / 28, 0, INT_MAX);