diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-20 03:20:43 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-20 04:04:30 +0100 |
commit | cf5f4c5169639349262aa221ae485a0de188afb1 (patch) | |
tree | fa43f18ee2e0774b6795fb13a12659a51456d227 /libavcodec/aacsbr.c | |
parent | aed128f07d142a7afc51f1f0c572a31b3b9bc2a6 (diff) | |
download | ffmpeg-cf5f4c5169639349262aa221ae485a0de188afb1.tar.gz |
aacsbr: check sample_rate before using it, fix division by 0
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/aacsbr.c')
-rw-r--r-- | libavcodec/aacsbr.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index ceff2eaa5b..8c67a75c89 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -340,9 +340,6 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, } else temp = 5000; - start_min = ((temp << 7) + (sbr->sample_rate >> 1)) / sbr->sample_rate; - stop_min = ((temp << 8) + (sbr->sample_rate >> 1)) / sbr->sample_rate; - switch (sbr->sample_rate) { case 16000: sbr_offset_ptr = sbr_offset[0]; @@ -368,6 +365,9 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, return -1; } + start_min = ((temp << 7) + (sbr->sample_rate >> 1)) / sbr->sample_rate; + stop_min = ((temp << 8) + (sbr->sample_rate >> 1)) / sbr->sample_rate; + sbr->k[0] = start_min + sbr_offset_ptr[spectrum->bs_start_freq]; if (spectrum->bs_stop_freq < 14) { |