Commit cf5f4c51 authored by Michael Niedermayer's avatar Michael Niedermayer

aacsbr: check sample_rate before using it, fix division by 0

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent aed128f0
...@@ -340,9 +340,6 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, ...@@ -340,9 +340,6 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
} else } else
temp = 5000; 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) { switch (sbr->sample_rate) {
case 16000: case 16000:
sbr_offset_ptr = sbr_offset[0]; sbr_offset_ptr = sbr_offset[0];
...@@ -368,6 +365,9 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, ...@@ -368,6 +365,9 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
return -1; 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]; sbr->k[0] = start_min + sbr_offset_ptr[spectrum->bs_start_freq];
if (spectrum->bs_stop_freq < 14) { if (spectrum->bs_stop_freq < 14) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment