diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-07-11 00:09:46 +0200 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-11-26 01:37:56 +0100 |
commit | 0cf02e015bacdd7059db243847c71e0ef780997a (patch) | |
tree | c18c460be0b65037394ae451560773e584e7d37f | |
parent | 4202e9d9724471c339b207af647c13cc6689c615 (diff) | |
download | ffmpeg-0cf02e015bacdd7059db243847c71e0ef780997a.tar.gz |
riffdec: prevent negative bit rate
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 189420cb561929e05f5cc4224cdca83740a24a32)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r-- | libavformat/riffdec.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c index 567b2a4734..d200116a87 100644 --- a/libavformat/riffdec.c +++ b/libavformat/riffdec.c @@ -94,6 +94,14 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, codec->sample_rate = avio_rl32(pb); codec->bit_rate = avio_rl32(pb) * 8; codec->block_align = avio_rl16(pb); + if (codec->bit_rate < 0) { + av_log(s, AV_LOG_WARNING, + "Invalid bit rate: %d\n", codec->bit_rate); + if (s->error_recognition & AV_EF_EXPLODE) + return AVERROR_INVALIDDATA; + else + codec->bit_rate = 0; + } if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */ codec->bits_per_coded_sample = 8; } else |