+ CurPtr += sizeof(coff_file_header);
+
+ if (hasPEHeader) {
+ PE32Header = reinterpret_cast<const pe32_header *>(base() + CurPtr);
+ if (!checkAddr(Data, ec, uintptr_t(PE32Header), sizeof(pe32_header)))
+ return;
+ // We only support PE32. If this is PE32 (not PE32+), the magic byte
+ // should be 0x10b. If this is not PE32, continue as if there's no PE
+ // header in this file.
+ if (PE32Header->Magic != 0x10b)
+ PE32Header = 0;
+ // There may be optional data directory after PE header. Skip them.
+ CurPtr += COFFHeader->SizeOfOptionalHeader;
+ }