summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2012-01-20 08:00:30 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2012-01-20 08:00:30 +0000
commitdd651262a551fc7dcdd3569127b199cec316b136 (patch)
tree5559b60b465985dcf37f7ae1a189a719a45e2e21
parentf1987dedee7d909a3b18a988846f281880f6c16c (diff)
downloadedk2-dd651262a551fc7dcdd3569127b199cec316b136.tar.gz
edk2-dd651262a551fc7dcdd3569127b199cec316b136.tar.bz2
edk2-dd651262a551fc7dcdd3569127b199cec316b136.zip
Sync patch r12470 and r12544 from main trunk.
1. Add more check to avoid access violation. 2. Use a local variable and assign 0 to it, then use it as legacy interrupt table base address. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010@12949 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c2
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c2
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/Thunk16/X86Thunk.c11
3 files changed, 11 insertions, 4 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c
index b82b02e018..a55aa2ba9f 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c
@@ -358,7 +358,7 @@ UefiIfrGetBufferTypeDefaults (
ASSERT (UefiDefaults != NULL);
*UefiDefaults = AllocateZeroPool (sizeof (LIST_ENTRY));
- ASSERT (UefiDefaults != NULL);
+ ASSERT (*UefiDefaults != NULL);
InitializeListHead (*UefiDefaults);
DefaultLink = GetFirstNode (&ThunkContext->FormSet->DefaultStoreListHead);
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c
index dd674f53f9..92fa85abcf 100644
--- a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c
+++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c
@@ -582,7 +582,7 @@ Returns:
//
// Return an error if buffer is too small
//
- if (SizeOfNvStore > *ImageLength) {
+ if (SizeOfNvStore > *ImageLength || DefaultImage == NULL) {
gBS->FreePool (OldData);
*ImageLength = (UINT16) SizeOfNvStore;
return EFI_BUFFER_TOO_SMALL;
diff --git a/EdkCompatibilityPkg/Foundation/Library/Thunk16/X86Thunk.c b/EdkCompatibilityPkg/Foundation/Library/Thunk16/X86Thunk.c
index 76c93b28ae..b12045ed66 100644
--- a/EdkCompatibilityPkg/Foundation/Library/Thunk16/X86Thunk.c
+++ b/EdkCompatibilityPkg/Foundation/Library/Thunk16/X86Thunk.c
@@ -311,8 +311,15 @@ Returns:
--*/
{
- RegisterSet->E.EIP = (UINT16)((UINT32 *)NULL)[IntNumber];
- RegisterSet->E.CS = (UINT16)(((UINT32 *)NULL)[IntNumber] >> 16);
+ UINT32 *VectorBase;
+
+ //
+ // The base address of legacy interrupt vector table is 0.
+ // We use this base address to get the legacy interrupt handler.
+ //
+ VectorBase = 0;
+ RegisterSet->E.EIP = (UINT16)(VectorBase)[IntNumber];
+ RegisterSet->E.CS = (UINT16)((VectorBase)[IntNumber] >> 16);
return AsmThunk16 (ThunkContext, RegisterSet, Flags | THUNK_INTERRUPT);
}