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 189420cb56)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
Andreas Cadhalpun 2015-07-11 00:09:46 +02:00
parent 68c0d66d4d
commit 16cbc7a930
1 changed files with 8 additions and 0 deletions

View File

@ -91,6 +91,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