ImageContext,\r
RelocDir->VirtualAddress + RelocDir->Size - 1\r
);\r
+ if (RelocBase == NULL || RelocBaseEnd == NULL || RelocBaseEnd < RelocBase) {\r
+ ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;\r
+ return RETURN_LOAD_ERROR;\r
+ }\r
} else {\r
//\r
// Set base and end to bypass processing below.\r
ImageContext,\r
RelocDir->VirtualAddress + RelocDir->Size - 1\r
);\r
+ if (RelocBase == NULL || RelocBaseEnd == NULL || RelocBaseEnd < RelocBase) {\r
+ ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;\r
+ return RETURN_LOAD_ERROR;\r
+ }\r
} else {\r
//\r
// Set base and end to bypass processing below.\r
RelocEnd = (UINT16 *) ((CHAR8 *) RelocBase + RelocBase->SizeOfBlock);\r
if (!(ImageContext->IsTeImage)) {\r
FixupBase = PeCoffLoaderImageAddress (ImageContext, RelocBase->VirtualAddress);\r
+ if (FixupBase == NULL) {\r
+ ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;\r
+ return RETURN_LOAD_ERROR;\r
+ }\r
} else {\r
FixupBase = (CHAR8 *)(UINTN)(ImageContext->ImageAddress +\r
RelocBase->VirtualAddress +\r
/** @file\r
EFI tools utility functions to display warning, error, and informational messages\r
\r
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
//\r
time (&CurrentTime);\r
NewTime = localtime (&CurrentTime);\r
- fprintf (stdout, "%04d-%02d-%02d %02d:%02d:%02d",\r
- NewTime->tm_year + 1900,\r
- NewTime->tm_mon + 1,\r
- NewTime->tm_mday,\r
- NewTime->tm_hour,\r
- NewTime->tm_min,\r
- NewTime->tm_sec\r
- );\r
+ if (NewTime != NULL) {\r
+ fprintf (stdout, "%04d-%02d-%02d %02d:%02d:%02d",\r
+ NewTime->tm_year + 1900,\r
+ NewTime->tm_mon + 1,\r
+ NewTime->tm_mday,\r
+ NewTime->tm_hour,\r
+ NewTime->tm_min,\r
+ NewTime->tm_sec\r
+ );\r
+ }\r
if (Cptr != NULL) {\r
sprintf (Line, ": %s", Cptr);\r
if (LineNumber != 0) {\r
/** @file\r
EFI Firmware Volume routines which work on a Fv image in buffers.\r
\r
-Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
\r
if (*DestinationFv == NULL) {\r
*DestinationFv = CommonLibBinderAllocate (size);\r
+ if (*DestinationFv == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
}\r
\r
CommonLibBinderCopyMem (*DestinationFv, SourceFv, size);\r
/** @file\r
File for memory allocation tracking functions.\r
\r
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
//\r
// Check parameters.\r
//\r
- if (File == NULL || Line == 0) {\r
+ if (File == NULL) {\r
+ printf (\r
+ "\nMyCheck(Final=%u, File=NULL, Line=%u)"\r
+ "Invalid parameter(s).\n",\r
+ Final,\r
+ (unsigned)Line\r
+ );\r
+\r
+ exit (1);\r
+ }\r
+\r
+ if (Line == 0) {\r
printf (\r
"\nMyCheck(Final=%u, File=%s, Line=%u)"\r
"Invalid parameter(s).\n",\r
//\r
// Check for invalid parameters.\r
//\r
- if (Size == 0 || File == NULL || Line == 0) {\r
+ if (File == NULL) {\r
+ printf (\r
+ "\nMyAlloc(Size=%u, File=NULL, Line=%u)"\r
+ "\nInvalid parameter(s).\n",\r
+ (unsigned)Size,\r
+ (unsigned)Line\r
+ );\r
+\r
+ exit (1);\r
+ }\r
+\r
+ if (Size == 0 || Line == 0) {\r
printf (\r
"\nMyAlloc(Size=%u, File=%s, Line=%u)"\r
"\nInvalid parameter(s).\n",\r
//\r
// Check for invalid parameter(s).\r
//\r
- if (Size == 0 || File == NULL || Line == 0) {\r
+ if (File == NULL) {\r
+ printf (\r
+ "\nMyRealloc(Ptr=%p, Size=%u, File=NULL, Line=%u)"\r
+ "\nInvalid parameter(s).\n",\r
+ Ptr,\r
+ (unsigned)Size,\r
+ (unsigned)Line\r
+ );\r
+\r
+ exit (1);\r
+ }\r
+\r
+ if (Size == 0 || Line == 0) {\r
printf (\r
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"\r
"\nInvalid parameter(s).\n",\r
//\r
// Check for invalid parameter(s).\r
//\r
- if (File == NULL || Line == 0) {\r
+ if (File == NULL) {\r
+ printf (\r
+ "\nMyFree(Ptr=%p, File=NULL, Line=%u)"\r
+ "\nInvalid parameter(s).\n",\r
+ Ptr,\r
+ (unsigned)Line\r
+ );\r
+\r
+ exit (1);\r
+ }\r
+\r
+ if (Line == 0) {\r
printf (\r
"\nMyFree(Ptr=%p, File=%s, Line=%u)"\r
"\nInvalid parameter(s).\n",\r
/** @file\r
Helper functions for parsing GuidedSectionTools.txt\r
\r
-Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
NewGuidTool->Name = CloneString(Tool->Strings[1]);\r
NewGuidTool->Path = CloneString(Tool->Strings[2]);\r
NewGuidTool->Next = NULL;\r
+\r
+ if (FirstGuidTool == NULL) {\r
+ FirstGuidTool = NewGuidTool;\r
+ } else {\r
+ LastGuidTool->Next = NewGuidTool;\r
+ }\r
+ LastGuidTool = NewGuidTool;\r
}\r
- if (FirstGuidTool == NULL) {\r
- FirstGuidTool = NewGuidTool;\r
- } else {\r
- LastGuidTool->Next = NewGuidTool;\r
- }\r
- LastGuidTool = NewGuidTool;\r
}\r
FreeStringList (Tool);\r
}\r
and Pointers to repeated strings. This sequence is further divided into Blocks \r
and Huffman codings are applied to each Block.\r
\r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
UINT32 Index;\r
\r
mText = malloc (WNDSIZ * 2 + MAXMATCH);\r
+ if (mText == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
for (Index = 0; Index < WNDSIZ * 2 + MAXMATCH; Index++) {\r
mText[Index] = 0;\r
}\r
mParent = malloc (WNDSIZ * 2 * sizeof (*mParent));\r
mPrev = malloc (WNDSIZ * 2 * sizeof (*mPrev));\r
mNext = malloc ((MAX_HASH_VAL + 1) * sizeof (*mNext));\r
+ if (mLevel == NULL || mChildCount == NULL || mPosition == NULL ||\r
+ mParent == NULL || mPrev == NULL || mNext == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
\r
mBufSiz = BLKSIZ;\r
mBuf = malloc (mBufSiz);\r