]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update HobLib and Hob Service to avoid data over flow.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 17 Jul 2012 01:50:52 +0000 (01:50 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 17 Jul 2012 01:50:52 +0000 (01:50 +0000)
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Rui Sun <rui.sun@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13532 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Library/HobLib.h
MdePkg/Library/DxeCoreHobLib/HobLib.c
MdePkg/Library/DxeHobLib/HobLib.c
MdePkg/Library/PeiHobLib/HobLib.c

index 8af7fbe0e1bc4c7e8da1ca5622e00d8d2982cd45..c990076a955c220af250bbbdd9e5722fdcddd881 100644 (file)
@@ -8,7 +8,7 @@
   allows the PEI phase to pass information to the DXE phase. HOBs are position \r
   independent and can be relocated easily to different memory memory locations.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, 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
@@ -220,7 +220,8 @@ BuildResourceDescriptorHob (
   \r
   If Guid is NULL, then ASSERT().\r
   If there is no additional space for HOB creation, then ASSERT().\r
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r
 \r
   @param  Guid          The GUID to tag the customized HOB.\r
   @param  DataLength    The size of the data payload for the GUID HOB.\r
@@ -250,7 +251,8 @@ BuildGuidHob (
   If Guid is NULL, then ASSERT().\r
   If Data is NULL and DataLength > 0, then ASSERT().\r
   If there is no additional space for HOB creation, then ASSERT().\r
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r
 \r
   @param  Guid          The GUID to tag the customized HOB.\r
   @param  Data          The data to be copied into the data field of the GUID HOB.\r
index 912f97d89811a17bee0d4f43470ad54b8cce0f19..afa66b4f9dad6e344d11716aa3c094fa25f99c14 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   HOB Library implementation for DxeCore driver.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, 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
@@ -281,7 +281,8 @@ BuildResourceDescriptorHob (
   \r
   If Guid is NULL, then ASSERT().\r
   If there is no additional space for HOB creation, then ASSERT().\r
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r
 \r
   @param  Guid          The GUID to tag the customized HOB.\r
   @param  DataLength    The size of the data payload for the GUID HOB.\r
@@ -318,7 +319,8 @@ BuildGuidHob (
   If Guid is NULL, then ASSERT().\r
   If Data is NULL and DataLength > 0, then ASSERT().\r
   If there is no additional space for HOB creation, then ASSERT().\r
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r
 \r
   @param  Guid          The GUID to tag the customized HOB.\r
   @param  Data          The data to be copied into the data field of the GUID HOB.\r
index 3a015bb192a785423afb359c95c05ae39b5830d3..215436149d2b874206bd606b53c94f9a693cd917 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   HOB Library implemenation for Dxe Phase.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, 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
@@ -314,7 +314,8 @@ BuildResourceDescriptorHob (
   \r
   If Guid is NULL, then ASSERT().\r
   If there is no additional space for HOB creation, then ASSERT().\r
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r
 \r
   @param  Guid          The GUID to tag the customized HOB.\r
   @param  DataLength    The size of the data payload for the GUID HOB.\r
@@ -351,7 +352,8 @@ BuildGuidHob (
   If Guid is NULL, then ASSERT().\r
   If Data is NULL and DataLength > 0, then ASSERT().\r
   If there is no additional space for HOB creation, then ASSERT().\r
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r
 \r
   @param  Guid          The GUID to tag the customized HOB.\r
   @param  Data          The data to be copied into the data field of the GUID HOB.\r
index 113de832fc488577278732c51eff31a3da12791e..0586ba86c0b4b9755b8dd4a238fb65854a3eff94 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provide Hob Library functions for Pei phase.\r
 \r
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2012, 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
@@ -349,7 +349,8 @@ BuildResourceDescriptorHob (
   \r
   If Guid is NULL, then ASSERT().\r
   If there is no additional space for HOB creation, then ASSERT().\r
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r
 \r
   @param  Guid          The GUID to tag the customized HOB.\r
   @param  DataLength    The size of the data payload for the GUID HOB.\r
@@ -375,7 +376,7 @@ BuildGuidHob (
   //\r
   // Make sure that data length is not too long.\r
   //\r
-  ASSERT (DataLength <= (0xffff - sizeof (EFI_HOB_GUID_TYPE)));\r
+  ASSERT (DataLength <= (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)));\r
 \r
   Hob = InternalPeiCreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16) (sizeof (EFI_HOB_GUID_TYPE) + DataLength));\r
   if (Hob == NULL) {\r
@@ -399,7 +400,8 @@ BuildGuidHob (
   If Guid is NULL, then ASSERT().\r
   If Data is NULL and DataLength > 0, then ASSERT().\r
   If there is no additional space for HOB creation, then ASSERT().\r
-  If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r
 \r
   @param  Guid          The GUID to tag the customized HOB.\r
   @param  Data          The data to be copied into the data field of the GUID HOB.\r