Skip to content

Commit 23d3628

Browse files
committed
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
1 parent 44c1f01 commit 23d3628

File tree

1 file changed

+1
-1
lines changed
  • media/libstagefright/codecs/aacenc/src

1 file changed

+1
-1
lines changed

media/libstagefright/codecs/aacenc/src/adj_thr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ static void correctThresh(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
465465
deltaSfbPe = *psfbPeFactors * deltaPe;
466466

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

0 commit comments

Comments
 (0)