summaryrefslogtreecommitdiff
path: root/libavformat/westwood_aud.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-10-16 22:42:32 +0200
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-10-17 20:42:18 +0200
commitbc7e128a6e8e2a79d0ff7cab5e8a799b3ea042ea (patch)
treee621e398f92720afbde42540e2cbbd3be4cb88f7 /libavformat/westwood_aud.c
parent9959a52b14bcfa3e5baeb3fc8a86c04bbc0d3d5d (diff)
downloadffmpeg-bc7e128a6e8e2a79d0ff7cab5e8a799b3ea042ea.tar.gz
westwood_aud: prevent division by zero
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavformat/westwood_aud.c')
-rw-r--r--libavformat/westwood_aud.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/westwood_aud.c b/libavformat/westwood_aud.c
index 4750167f13..9c2d35cb8a 100644
--- a/libavformat/westwood_aud.c
+++ b/libavformat/westwood_aud.c
@@ -164,6 +164,12 @@ static int wsaud_read_packet(AVFormatContext *s,
if (ret != chunk_size)
return AVERROR(EIO);
+ if (st->codecpar->channels <= 0) {
+ av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n",
+ st->codecpar->channels);
+ return AVERROR_INVALIDDATA;
+ }
+
/* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
pkt->duration = (chunk_size * 2) / st->codecpar->channels;
}