Add the logic to check whether mCoffAlignment is larger than
MAX_COFF_ALIGNMENT, and report error for it.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
/** @file\r
Elf32 Convert solution\r
\r
/** @file\r
Elf32 Convert solution\r
\r
-Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>\r
\r
This program and the accompanying materials are licensed and made available\r
Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>\r
\r
This program and the accompanying materials are licensed and made available\r
+ //\r
+ // Check if mCoffAlignment is larger than MAX_COFF_ALIGNMENT\r
+ //\r
+ if (mCoffAlignment > MAX_COFF_ALIGNMENT) {\r
+ Error (NULL, 0, 3000, "Invalid", "Section alignment is larger than MAX_COFF_ALIGNMENT.");\r
+ assert (FALSE);\r
+ }\r
+\r
//\r
// Move the PE/COFF header right before the first section. This will help us\r
// save space when converting to TE.\r
//\r
// Move the PE/COFF header right before the first section. This will help us\r
// save space when converting to TE.\r
/** @file\r
Elf64 convert solution\r
\r
/** @file\r
Elf64 convert solution\r
\r
-Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
Portions copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>\r
\r
This program and the accompanying materials are licensed and made available\r
Portions copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>\r
\r
This program and the accompanying materials are licensed and made available\r
+ //\r
+ // Check if mCoffAlignment is larger than MAX_COFF_ALIGNMENT\r
+ //\r
+ if (mCoffAlignment > MAX_COFF_ALIGNMENT) {\r
+ Error (NULL, 0, 3000, "Invalid", "Section alignment is larger than MAX_COFF_ALIGNMENT.");\r
+ assert (FALSE);\r
+ }\r
+\r
+\r
//\r
// Move the PE/COFF header right before the first section. This will help us\r
// save space when converting to TE.\r
//\r
// Move the PE/COFF header right before the first section. This will help us\r
// save space when converting to TE.\r