Skip to content

Commit

Permalink
aacsbr: check sample_rate before using it, fix division by 0
Browse files Browse the repository at this point in the history
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
  • Loading branch information
michaelni committed Nov 20, 2012
1 parent aed128f commit cf5f4c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libavcodec/aacsbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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) {
Expand Down

0 comments on commit cf5f4c5

Please sign in to comment.