aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-11-09 20:41:16 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-12 00:43:01 +0100
commit46f83b059b26894281b4478ff6e97f833e4367a2 (patch)
tree606bc71516cdca6254d9331739ae4547cc6597d1
parentce2664f5f727b9d86fcf49a72b6a30d1ec2856e5 (diff)
downloadffmpeg-46f83b059b26894281b4478ff6e97f833e4367a2.tar.gz
aacsbr_fixed: check for envelope scalefactors overflowing
This prevents various values from getting an insanely huge exponent. If someone knows a cleaner solution, thats welcome! This is similar to commit 8978c74 for aacsbr. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> (cherry picked from commit 0e36a14a423b7cb32d54d1b621cc9136cccc3dc5) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/aacsbr_fixed.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libavcodec/aacsbr_fixed.c b/libavcodec/aacsbr_fixed.c
index 8eb8c5867f..b4e3ac7f76 100644
--- a/libavcodec/aacsbr_fixed.c
+++ b/libavcodec/aacsbr_fixed.c
@@ -169,6 +169,10 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
else
temp1.mant = 0x20000000;
temp1.exp = (temp1.exp >> 1) + 1;
+ if (temp1.exp > 66) { // temp1 > 1E20
+ av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
+ temp1 = FLOAT_1;
+ }
temp2.exp = (pan_offset - sbr->data[1].env_facs[e][k].mant) * alpha;
if (temp2.exp & 1)
@@ -188,6 +192,10 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
temp1.exp = NOISE_FLOOR_OFFSET - \
sbr->data[0].noise_facs[e][k].mant + 2;
temp1.mant = 0x20000000;
+ if (temp1.exp > 66) { // temp1 > 1E20
+ av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
+ temp1 = FLOAT_1;
+ }
temp2.exp = 12 - sbr->data[1].noise_facs[e][k].mant + 1;
temp2.mant = 0x20000000;
fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2));
@@ -208,7 +216,10 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
else
temp1.mant = 0x20000000;
temp1.exp = (temp1.exp >> 1) + 1;
-
+ if (temp1.exp > 66) { // temp1 > 1E20
+ av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
+ temp1 = FLOAT_1;
+ }
sbr->data[ch].env_facs[e][k] = temp1;
}
for (e = 1; e <= sbr->data[ch].bs_num_noise; e++)