Skip to content

Commit

Permalink
Reapply: Avoid reading out of bounds due to negative aaIccIndexMapped
Browse files Browse the repository at this point in the history
Fixes: 10325/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBFDK_AAC_fuzzer-5740113355603968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
  • Loading branch information
mstorsjo committed Sep 26, 2018
1 parent cf02a1a commit e7e269c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libSBRdec/src/psdec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ void initSlotBasedRotation(

FIXP_SGL invL;
FIXP_DBL ScaleL, ScaleR;
FIXP_DBL Alpha, Beta;
FIXP_DBL Alpha, Beta, AlphasValue;
FIXP_DBL h11r, h12r, h21r, h22r;

const FIXP_DBL *PScaleFactors;
Expand Down Expand Up @@ -363,12 +363,15 @@ void initSlotBasedRotation(
ScaleL = PScaleFactors[noIidSteps - h_ps_d->specificTo.mpeg.pCoef
->aaIidIndexMapped[env][bin]];

AlphasValue = 0;
if (h_ps_d->specificTo.mpeg.pCoef->aaIccIndexMapped[env][bin] >= 0)
AlphasValue = Alphas[h_ps_d->specificTo.mpeg.pCoef->aaIccIndexMapped[env][bin]];
Beta = fMult(
fMult(Alphas[h_ps_d->specificTo.mpeg.pCoef->aaIccIndexMapped[env][bin]],
fMult(AlphasValue,
(ScaleR - ScaleL)),
FIXP_SQRT05);
Alpha =
Alphas[h_ps_d->specificTo.mpeg.pCoef->aaIccIndexMapped[env][bin]] >> 1;
AlphasValue >> 1;

/* Alpha and Beta are now both scaled by 2 shifts right */

Expand Down

0 comments on commit e7e269c

Please sign in to comment.