aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/oggparsespeex.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-10-23 17:12:49 +0200
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-11-07 00:51:49 +0100
commiteb205eda3fec9959037c419548b1ebfaa6c59c33 (patch)
treedb4248ebfabb3cffae78600dcf0e56e5f1a9ed52 /libavformat/oggparsespeex.c
parentf748e3b5a219061db021d8b6b7ebb097c65f23c5 (diff)
downloadffmpeg-eb205eda3fec9959037c419548b1ebfaa6c59c33.tar.gz
oggparsespeex: validate sample_rate
A negative sample rate doesn't make sense and triggers assertions in av_rescale_rnd. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavformat/oggparsespeex.c')
-rw-r--r--libavformat/oggparsespeex.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c
index 434b0fdab1..2b49150878 100644
--- a/libavformat/oggparsespeex.c
+++ b/libavformat/oggparsespeex.c
@@ -68,6 +68,10 @@ static int speex_header(AVFormatContext *s, int idx) {
}
st->codecpar->sample_rate = AV_RL32(p + 36);
+ if (st->codecpar->sample_rate <= 0) {
+ av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate);
+ return AVERROR_INVALIDDATA;
+ }
st->codecpar->channels = AV_RL32(p + 48);
if (st->codecpar->channels < 1 || st->codecpar->channels > 2) {
av_log(s, AV_LOG_ERROR, "invalid channel count. Speex must be mono or stereo.\n");