DO NOT MERGE Prevent out of bound memory access in GetInvInt

am: 070e7b81c0

Change-Id: Ibcddd5c0e53aaae0d26e1c33c6e42bc7268cf6a1
This commit is contained in:
Jean-Michel Trivi 2017-11-03 19:10:04 +00:00 committed by android-build-merger
commit 6fac7101c6
1 changed files with 8 additions and 4 deletions

View File

@ -450,14 +450,18 @@ inline FIXP_DBL fAddSaturate(const FIXP_DBL a, const FIXP_DBL b)
/**
* \brief Calculate the value of 1/i where i is a integer value. It supports
* input values from 1 upto 50.
* input values from 0 upto 49.
* \param intValue Integer input value.
* \param FIXP_DBL representation of 1/intValue
*/
inline FIXP_DBL GetInvInt(int intValue)
{
FDK_ASSERT((intValue > 0) && (intValue < 50));
FDK_ASSERT(intValue<50);
FDK_ASSERT((intValue >= 0) && (intValue < 50));
if (intValue < 0)
return invCount[0];
else if (intValue > 49)
return invCount[49];
else
return invCount[intValue];
}