Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23d36286 authored by Martin Storsjo's avatar Martin Storsjo
Browse files

stagefright aacenc: Avoid a division by zero

In rare cases, the result of normFactor * (*psfbNActiveLines)
could be zero, leading to a division by zero in pow2_xy.

In these cases, normFactor was INT_MIN, and if *psfbNActiveLines
was 2, the product was zero.

normFactor being INT_MIN is a bug in itself though.

Change-Id: Ib31bf02889615a7be3bd1bc028da8a7651a8dbee
parent 44c1f012
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -465,7 +465,7 @@ static void correctThresh(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
        deltaSfbPe = *psfbPeFactors * deltaPe;

		/* thr3(n) = thr2(n)*2^deltaSfbPe/b(n) */
        if (*psfbNActiveLines > 0) {
        if (*psfbNActiveLines > 0 && (normFactor* (*psfbNActiveLines)) != 0) {
          /* new threshold */
          Word32 thrFactor;
          sfbEn  = psyOutChan->sfbEnergy[sfbGrp+sfb];