aboutsummaryrefslogtreecommitdiff
path: root/libavformat/vqf.c
diff options
context:
space:
mode:
authorMichael Niedermayer2013-05-07 22:26:22 +0200
committerMichael Niedermayer2013-05-07 22:26:56 +0200
commita527e692592b7eef69430cc866bb96231526316c (patch)
tree1bdb2bb2a46ce22d856787beae746cf689fe8262 /libavformat/vqf.c
parent9dd04f6d8cdd1c10c28b2cb4252c1a41df581915 (diff)
avformat/vqf: check number of channels before use.
Fixes division by zero Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/vqf.c')
-rw-r--r--libavformat/vqf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index ed588288b8..1ce53595d6 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -132,6 +132,11 @@ static int vqf_read_header(AVFormatContext *s)
rate_flag = AV_RB32(comm_chunk + 8);
avio_skip(s->pb, len-12);
+ if (st->codec->channels <= 0) {
+ av_log(s, AV_LOG_ERROR, "Invalid number of channels\n");
+ return AVERROR_INVALIDDATA;
+ }
+
st->codec->bit_rate = read_bitrate*1000;
break;
case MKTAG('D','S','I','Z'): // size of compressed data