summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-24 03:39:02 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-24 03:39:02 +0000
commit0ba7fffd25ca2751b26dbcd97c0002996d43651a (patch)
tree6d775bdf95ba293c3e6d6c7b50bdc4dab7d14d7a /MdePkg
parentcc4678aa94539f74c5642a12041d0d5a6fb80907 (diff)
downloadedk2-platforms-0ba7fffd25ca2751b26dbcd97c0002996d43651a.tar.xz
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
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
index 840ea5f2c1..9d0fd7d131 100644
--- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
+++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
@@ -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;
}