mirror of https://github.com/acidanthera/audk.git
Add code check to avoid access violation.
Signed-off-by:ydong10 Reviewed-by:lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13036 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
65cc57fc41
commit
3dbef428c7
|
@ -50,6 +50,10 @@ GetExtractGuidedSectionHandlerInfo (
|
||||||
// Set the available memory address to handler info.
|
// Set the available memory address to handler info.
|
||||||
//
|
//
|
||||||
HandlerInfo = (EXTRACT_GUIDED_SECTION_HANDLER_INFO*)(VOID*)(UINTN) PcdGet64 (PcdGuidedExtractHandlerTableAddress);
|
HandlerInfo = (EXTRACT_GUIDED_SECTION_HANDLER_INFO*)(VOID*)(UINTN) PcdGet64 (PcdGuidedExtractHandlerTableAddress);
|
||||||
|
if (HandlerInfo == NULL) {
|
||||||
|
*InfoPointer = NULL;
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// First check whether the handler information structure is initialized.
|
// First check whether the handler information structure is initialized.
|
||||||
|
@ -129,6 +133,7 @@ ExtractGuidedSectionGetGuidList (
|
||||||
//
|
//
|
||||||
// Get GuidTable and Table Number
|
// Get GuidTable and Table Number
|
||||||
//
|
//
|
||||||
|
ASSERT (HandlerInfo != NULL);
|
||||||
*ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable;
|
*ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable;
|
||||||
return HandlerInfo->NumberOfExtractHandler;
|
return HandlerInfo->NumberOfExtractHandler;
|
||||||
}
|
}
|
||||||
|
@ -187,6 +192,7 @@ ExtractGuidedSectionRegisterHandlers (
|
||||||
//
|
//
|
||||||
// Search the match registered GetInfo handler for the input guided section.
|
// Search the match registered GetInfo handler for the input guided section.
|
||||||
//
|
//
|
||||||
|
ASSERT (HandlerInfo != NULL);
|
||||||
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
||||||
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {
|
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {
|
||||||
//
|
//
|
||||||
|
@ -288,6 +294,7 @@ ExtractGuidedSectionGetInfo (
|
||||||
//
|
//
|
||||||
// Search the match registered GetInfo handler for the input guided section.
|
// Search the match registered GetInfo handler for the input guided section.
|
||||||
//
|
//
|
||||||
|
ASSERT (HandlerInfo != NULL);
|
||||||
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
||||||
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
|
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
|
||||||
//
|
//
|
||||||
|
@ -381,6 +388,7 @@ ExtractGuidedSectionDecode (
|
||||||
//
|
//
|
||||||
// Search the match registered Extract handler for the input guided section.
|
// Search the match registered Extract handler for the input guided section.
|
||||||
//
|
//
|
||||||
|
ASSERT (HandlerInfo != NULL);
|
||||||
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
||||||
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
|
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
|
||||||
//
|
//
|
||||||
|
|
|
@ -156,6 +156,7 @@ ExtractGuidedSectionGetGuidList (
|
||||||
//
|
//
|
||||||
// Get GuidTable and Table Number
|
// Get GuidTable and Table Number
|
||||||
//
|
//
|
||||||
|
ASSERT (HandlerInfo != NULL);
|
||||||
*ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable;
|
*ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable;
|
||||||
return HandlerInfo->NumberOfExtractHandler;
|
return HandlerInfo->NumberOfExtractHandler;
|
||||||
}
|
}
|
||||||
|
@ -216,6 +217,7 @@ ExtractGuidedSectionRegisterHandlers (
|
||||||
//
|
//
|
||||||
// Search the match registered GetInfo handler for the input guided section.
|
// Search the match registered GetInfo handler for the input guided section.
|
||||||
//
|
//
|
||||||
|
ASSERT (HandlerInfo != NULL);
|
||||||
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
||||||
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {
|
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {
|
||||||
//
|
//
|
||||||
|
@ -317,6 +319,7 @@ ExtractGuidedSectionGetInfo (
|
||||||
//
|
//
|
||||||
// Search the match registered GetInfo handler for the input guided section.
|
// Search the match registered GetInfo handler for the input guided section.
|
||||||
//
|
//
|
||||||
|
ASSERT (HandlerInfo != NULL);
|
||||||
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
||||||
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
|
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
|
||||||
//
|
//
|
||||||
|
@ -410,6 +413,7 @@ ExtractGuidedSectionDecode (
|
||||||
//
|
//
|
||||||
// Search the match registered Extract handler for the input guided section.
|
// Search the match registered Extract handler for the input guided section.
|
||||||
//
|
//
|
||||||
|
ASSERT (HandlerInfo != NULL);
|
||||||
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
||||||
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
|
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue