summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-01 04:48:29 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-01 04:48:29 +0000
commit29666911f7291658004e1732514ed8ebf7040f13 (patch)
treeda9cbf451a502cd8f6cd40da37cbd38f068ea079 /MdePkg
parent3dc3861a4e3d19f45db22c90ef0fbdc0493daeb0 (diff)
downloadedk2-platforms-29666911f7291658004e1732514ed8ebf7040f13.tar.xz
Add check when use *Pointer as Sd->mRight[*Pointer] to avoid out of Array bound.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7382 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
index 9d0fd7d131..6dc1b84b87 100644
--- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
+++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
@@ -225,11 +225,13 @@ MakeTable (
Sd->mRight[Avail] = Sd->mLeft[Avail] = 0;
*Pointer = Avail++;
}
-
- if ((Index3 & Mask) != 0) {
- Pointer = &Sd->mRight[*Pointer];
- } else {
- Pointer = &Sd->mLeft[*Pointer];
+
+ if (*Pointer < (2 * NC - 1)) {
+ if ((Index3 & Mask) != 0) {
+ Pointer = &Sd->mRight[*Pointer];
+ } else {
+ Pointer = &Sd->mLeft[*Pointer];
+ }
}
Index3 <<= 1;