From 29b81acd78887b24c2995f89c7c34e1861afad69 Mon Sep 17 00:00:00 2001 From: Fraunhofer IIS FDK Date: Wed, 15 Aug 2018 14:40:03 +0200 Subject: [PATCH] Limit too large shift exponent in apply_inter_tes() Bug: 112892200 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I74e349ecb796343b475b825ac7d97497560a1e7a --- libSBRdec/src/env_calc.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libSBRdec/src/env_calc.cpp b/libSBRdec/src/env_calc.cpp index d7a8bb5..da01bed 100644 --- a/libSBRdec/src/env_calc.cpp +++ b/libSBRdec/src/env_calc.cpp @@ -626,7 +626,8 @@ static void apply_inter_tes(FIXP_DBL **qmfReal, FIXP_DBL **qmfImag, total_power_low >>= diff; total_power_low_sf = new_summand_sf; } else if (new_summand_sf < total_power_low_sf) { - new_summand >>= total_power_low_sf - new_summand_sf; + new_summand >>= + fMin(DFRACT_BITS - 1, total_power_low_sf - new_summand_sf); } total_power_low += (new_summand >> preShift2); @@ -638,7 +639,8 @@ static void apply_inter_tes(FIXP_DBL **qmfReal, FIXP_DBL **qmfImag, fMin(DFRACT_BITS - 1, new_summand_sf - total_power_high_sf); total_power_high_sf = new_summand_sf; } else if (new_summand_sf < total_power_high_sf) { - new_summand >>= total_power_high_sf - new_summand_sf; + new_summand >>= + fMin(DFRACT_BITS - 1, total_power_high_sf - new_summand_sf); } total_power_high += (new_summand >> preShift2);