aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-09-27 23:48:40 -0300
committerJames Almer <jamrial@gmail.com>2017-09-27 23:49:06 -0300
commite9a388061371d35a949106c627018122ad07eb04 (patch)
treee5f301a7aed89a260f2e729331e20eea16dd1388
parentb02b43a823a6ff0278f1ac5d0cfe3ac698d67ba5 (diff)
parentba30b74686f0cb6c9dd465ac4820059c48bf9d08 (diff)
downloadffmpeg-e9a388061371d35a949106c627018122ad07eb04.tar.gz
Merge commit 'ba30b74686f0cb6c9dd465ac4820059c48bf9d08'
* commit 'ba30b74686f0cb6c9dd465ac4820059c48bf9d08': aac: Validate the sbr sample rate before using the value See cf5f4c5169639349262aa221ae485a0de188afb1 Merged-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavcodec/aacsbr_template.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c
index 930d33e9e5..3fe78d5b62 100644
--- a/libavcodec/aacsbr_template.c
+++ b/libavcodec/aacsbr_template.c
@@ -261,13 +261,6 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
const int8_t *sbr_offset_ptr;
int16_t stop_dk[13];
- if (sbr->sample_rate < 32000) {
- temp = 3000;
- } else if (sbr->sample_rate < 64000) {
- temp = 4000;
- } else
- temp = 5000;
-
switch (sbr->sample_rate) {
case 16000:
sbr_offset_ptr = sbr_offset[0];
@@ -293,6 +286,13 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
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;