Add check when use Index as Array [Index] to avoid out of Array bound.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7366 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2009-01-24 03:39:02 +00:00
parent cc4678aa94
commit 0ba7fffd25
1 changed files with 3 additions and 3 deletions

View File

@ -221,7 +221,7 @@ MakeTable (
Index = (UINT16) (Len - TableBits);
while (Index != 0) {
if (*Pointer == 0) {
if (*Pointer == 0 && Avail < (2 * NC - 1)) {
Sd->mRight[Avail] = Sd->mLeft[Avail] = 0;
*Pointer = Avail++;
}
@ -375,7 +375,7 @@ ReadPTLen (
//
if (Index == Special) {
CharC = (UINT16) GetBits (Sd, 2);
while ((INT16) (--CharC) >= 0) {
while ((INT16) (--CharC) >= 0 && Index < NPT) {
Sd->mPTLen[Index++] = 0;
}
}
@ -457,7 +457,7 @@ ReadCLen (
CharC = (UINT16) (GetBits (Sd, CBIT) + 20);
}
while ((INT16) (--CharC) >= 0) {
while ((INT16) (--CharC) >= 0 && Index < NC) {
Sd->mCLen[Index++] = 0;
}