Browse Source

avformat/wavdec: Detect wrongly interpreted specification about the sample value in the fact chunk

Fixes Ticket703

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n2.8
Michael Niedermayer 10 years ago
parent
commit
acbd78a001
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      libavformat/wavdec.c

+ 9
- 0
libavformat/wavdec.c View File

@@ -434,6 +434,15 @@ break_loop:
data_size = 0; data_size = 0;
} }


if ( st->codec->bit_rate > 0 && data_size > 0
&& st->codec->sample_rate > 0
&& sample_count > 0 && st->codec->channels > 1
&& sample_count % st->codec->channels == 0) {
if (fabs(8.0 * data_size * st->codec->channels * st->codec->sample_rate /
sample_count /st->codec->bit_rate - 1.0) < 0.3)
sample_count /= st->codec->channels;
}

if ( data_size > 0 && sample_count && st->codec->channels if ( data_size > 0 && sample_count && st->codec->channels
&& (data_size << 3) / sample_count / st->codec->channels > st->codec->bits_per_coded_sample + 1) { && (data_size << 3) / sample_count / st->codec->channels > st->codec->bits_per_coded_sample + 1) {
av_log(s, AV_LOG_WARNING, "ignoring wrong sample_count %"PRId64"\n", sample_count); av_log(s, AV_LOG_WARNING, "ignoring wrong sample_count %"PRId64"\n", sample_count);


Loading…
Cancel
Save