File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,8 @@ static inline BOOLEAN verify_pe(const struct PeFileHeader *pe) {
122122 return CompareMem (pe -> Magic , PE_FILE_MAGIC , STRLEN (PE_FILE_MAGIC )) == 0 &&
123123 pe -> FileHeader .Machine == TARGET_MACHINE_TYPE &&
124124 pe -> FileHeader .NumberOfSections > 0 &&
125- pe -> FileHeader .NumberOfSections <= MAX_SECTIONS ;
125+ pe -> FileHeader .NumberOfSections <= MAX_SECTIONS &&
126+ IN_SET (pe -> OptionalHeader .Magic , OPTHDR32_MAGIC , OPTHDR64_MAGIC );
126127}
127128
128129static inline UINTN section_table_offset (const struct DosFileHeader * dos , const struct PeFileHeader * pe ) {
@@ -182,15 +183,8 @@ EFI_STATUS pe_alignment_info(
182183 return EFI_LOAD_ERROR ;
183184
184185 * ret_entry_point_address = pe -> OptionalHeader .AddressOfEntryPoint ;
185-
186- if (pe -> OptionalHeader .Magic == OPTHDR32_MAGIC ) {
187- * ret_size_of_image = pe -> OptionalHeader .SizeOfImage ;
188- * ret_section_alignment = pe -> OptionalHeader .SectionAlignment ;
189- } else if (pe -> OptionalHeader .Magic == OPTHDR64_MAGIC ) {
190- * ret_size_of_image = pe -> OptionalHeader .SizeOfImage ;
191- * ret_section_alignment = pe -> OptionalHeader .SectionAlignment ;
192- } else
193- return EFI_UNSUPPORTED ;
186+ * ret_size_of_image = pe -> OptionalHeader .SizeOfImage ;
187+ * ret_section_alignment = pe -> OptionalHeader .SectionAlignment ;
194188 return EFI_SUCCESS ;
195189}
196190
You can’t perform that action at this time.
0 commit comments