diff options
author | Fraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de> | 2019-11-13 16:04:48 +0100 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2020-01-14 14:35:18 -0800 |
commit | 70192726460eea96ddfc77ac86e2ba59fc758f26 (patch) | |
tree | d6c4c3c29d784e86ed065ec68dfb1ffdb742c220 | |
parent | 0c42941882ea8d9b11fc645ec46f5013009064ed (diff) | |
download | fdk-aac-70192726460eea96ddfc77ac86e2ba59fc758f26.tar.gz fdk-aac-70192726460eea96ddfc77ac86e2ba59fc758f26.tar.bz2 fdk-aac-70192726460eea96ddfc77ac86e2ba59fc758f26.zip |
Prevent signed integer overflow in fMultIceil() for case m_e=-31.
Bug: 146934600
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: I8a67a3b17f3ec3af753b6463b72ae2947986b39c
-rw-r--r-- | libFDK/include/fixpoint_math.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libFDK/include/fixpoint_math.h b/libFDK/include/fixpoint_math.h index 3805892..93aea19 100644 --- a/libFDK/include/fixpoint_math.h +++ b/libFDK/include/fixpoint_math.h @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------------- Software License for The Fraunhofer FDK AAC Codec Library for Android -© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten +© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. All rights reserved. 1. INTRODUCTION @@ -545,15 +545,20 @@ inline INT fMultIceil(FIXP_DBL a, INT b) { m = fMultNorm(a, (FIXP_DBL)b, &m_e); if (m_e < (INT)0) { - if (m_e > (INT)-DFRACT_BITS) { + if (m_e > (INT) - (DFRACT_BITS - 1)) { mi = (m >> (-m_e)); if ((LONG)m & ((1 << (-m_e)) - 1)) { mi = mi + (FIXP_DBL)1; } } else { - mi = (FIXP_DBL)1; - if (m < (FIXP_DBL)0) { - mi = (FIXP_DBL)0; + if (m > (FIXP_DBL)0) { + mi = (FIXP_DBL)1; + } else { + if ((m_e == -(DFRACT_BITS - 1)) && (m == (FIXP_DBL)MINVAL_DBL)) { + mi = (FIXP_DBL)-1; + } else { + mi = (FIXP_DBL)0; + } } } } else { |