mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-05-13 21:26:33 +02:00
aac: Validate the sbr sample rate before using the value
Avoid a floating point exception. Bug-Id: 1027 CC: libav-stable@libav.org
This commit is contained in:
parent
0ee78020cd
commit
ba30b74686
@ -327,16 +327,6 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
const int8_t *sbr_offset_ptr;
|
const int8_t *sbr_offset_ptr;
|
||||||
int16_t stop_dk[13];
|
int16_t stop_dk[13];
|
||||||
|
|
||||||
if (sbr->sample_rate < 32000) {
|
|
||||||
temp = 3000;
|
|
||||||
} else if (sbr->sample_rate < 64000) {
|
|
||||||
temp = 4000;
|
|
||||||
} 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) {
|
switch (sbr->sample_rate) {
|
||||||
case 16000:
|
case 16000:
|
||||||
sbr_offset_ptr = sbr_offset[0];
|
sbr_offset_ptr = sbr_offset[0];
|
||||||
@ -362,6 +352,16 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sbr->sample_rate < 32000) {
|
||||||
|
temp = 3000;
|
||||||
|
} else if (sbr->sample_rate < 64000) {
|
||||||
|
temp = 4000;
|
||||||
|
} 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;
|
||||||
|
|
||||||
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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user