mirror of https://github.com/acidanthera/audk.git
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@7348 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
80882266ed
commit
9872985bb1
|
@ -588,6 +588,7 @@ GetDriverBindingHandleFromImageHandle (
|
|||
|
||||
@param Private Pointer to EFI_CALLBACK_INFO.
|
||||
@param KeyValue The callback key value of device controller item in first page.
|
||||
KeyValue is larger than or equal to KEY_VALUE_DEVICE_OFFSET.
|
||||
@param FakeNvData Pointer to PLAT_OVER_MNGR_DATA.
|
||||
|
||||
@retval EFI_SUCCESS Always returned.
|
||||
|
|
|
@ -153,14 +153,15 @@ MakeTable (
|
|||
UINT16 WordOfCount;
|
||||
|
||||
|
||||
for (Index = 1; Index <= 16; Index++) {
|
||||
for (Index = 0; Index <= 16; Index++) {
|
||||
Count[Index] = 0;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < NumOfChar; Index++) {
|
||||
Count[BitLen[Index]]++;
|
||||
}
|
||||
|
||||
|
||||
Start[0] = 0;
|
||||
Start[1] = 0;
|
||||
|
||||
for (Index = 1; Index <= 16; Index++) {
|
||||
|
@ -175,7 +176,8 @@ MakeTable (
|
|||
}
|
||||
|
||||
JuBits = (UINT16) (16 - TableBits);
|
||||
|
||||
|
||||
Weight[0] = 0;
|
||||
for (Index = 1; Index <= TableBits; Index++) {
|
||||
Start[Index] >>= JuBits;
|
||||
Weight[Index] = (UINT16) (1U << (TableBits - Index));
|
||||
|
@ -201,7 +203,7 @@ MakeTable (
|
|||
for (Char = 0; Char < NumOfChar; Char++) {
|
||||
|
||||
Len = BitLen[Char];
|
||||
if (Len == 0) {
|
||||
if (Len == 0 || Len >= 17) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -221,7 +223,7 @@ MakeTable (
|
|||
|
||||
while (Index != 0) {
|
||||
if (*Pointer == 0) {
|
||||
Sd->mRight[Avail] = Sd->mLeft[Avail] = 0;
|
||||
Sd->mRight[Avail] = Sd->mLeft[Avail] = 0;
|
||||
*Pointer = Avail++;
|
||||
}
|
||||
|
||||
|
@ -347,7 +349,7 @@ ReadPTLen (
|
|||
|
||||
Index = 0;
|
||||
|
||||
while (Index < Number) {
|
||||
while (Index < Number && Index < NPT) {
|
||||
|
||||
CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3));
|
||||
|
||||
|
@ -382,7 +384,7 @@ ReadPTLen (
|
|||
}
|
||||
}
|
||||
|
||||
while (Index < nn) {
|
||||
while (Index < nn && Index < NPT) {
|
||||
Sd->mPTLen[Index++] = 0;
|
||||
}
|
||||
|
||||
|
@ -428,7 +430,7 @@ ReadCLen (
|
|||
}
|
||||
|
||||
Index = 0;
|
||||
while (Index < Number) {
|
||||
while (Index < Number && Index < NC) {
|
||||
CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
|
||||
if (CharC >= NT) {
|
||||
Mask = 1U << (BITBUFSIZ - 1 - 8);
|
||||
|
|
Loading…
Reference in New Issue