Ghidra is a software reverse engineering (SRE) framework
GP-955 Check machine arch to stop processing .PDATA section
jmlagor1c52410ad086
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/FileHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/FileHeader.javaindex f8295fc0a2..f4f66d5f1b 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/FileHeader.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/FileHeader.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -138,6 +138,35 @@ public class FileHeader implements StructConverter {"If Image is on Net, copy and run from the swap file", "System file", "File is a DLL","File should only be run on a UP machine", "Bytes of machine word are reversed" };+ /**+ * Values for the Machine field indicating the intended processor architecture+ */+ public final static int IMAGE_FILE_MACHINE_UNKNOWN = 0x0; // The content of this field is assumed to be applicable to any machine type+ public final static int IMAGE_FILE_MACHINE_AM33 = 0x1d3; // Matsushita AM33+ public final static int IMAGE_FILE_MACHINE_AMD64 = 0x8664; // x64+ public final static int IMAGE_FILE_MACHINE_ARM = 0x1c0; // ARM little endian+ public final static int IMAGE_FILE_MACHINE_ARM64 = 0xaa64; // ARM64 little endian+ public final static int IMAGE_FILE_MACHINE_ARMNT = 0x1c4; // ARM Thumb-2 little endian+ public final static int IMAGE_FILE_MACHINE_EBC = 0xebc; // EFI byte code+ public final static int IMAGE_FILE_MACHINE_I386 = 0x14c; // Intel 386 or later processors and compatible processors+ public final static int IMAGE_FILE_MACHINE_IA64 = 0x200; // Intel Itanium processor family+ public final static int IMAGE_FILE_MACHINE_M32R = 0x9041; // Mitsubishi M32R little endian+ public final static int IMAGE_FILE_MACHINE_MIPS16 = 0x266; // MIPS16+ public final static int IMAGE_FILE_MACHINE_MIPSFPU = 0x366; // MIPS with FPU+ public final static int IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466; // MIPS16 with FPU+ public final static int IMAGE_FILE_MACHINE_POWERPC = 0x1f0; // Power PC little endian+ public final static int IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1; // Power PC with floating point support+ public final static int IMAGE_FILE_MACHINE_R4000 = 0x166; // MIPS little endian+ public final static int IMAGE_FILE_MACHINE_RISCV32 = 0x5032; // RISC-V 32-bit address space+ public final static int IMAGE_FILE_MACHINE_RISCV64 = 0x5064; // RISC-V 64-bit address space+ public final static int IMAGE_FILE_MACHINE_RISCV128 = 0x5128; // RISC-V 128-bit address space+ public final static int IMAGE_FILE_MACHINE_SH3 = 0x1a2; // Hitachi SH3+ public final static int IMAGE_FILE_MACHINE_SH3DSP = 0x1a3; // Hitachi SH3 DSP+ public final static int IMAGE_FILE_MACHINE_SH4 = 0x1a6; // Hitachi SH4+ public final static int IMAGE_FILE_MACHINE_SH5 = 0x1a8; // Hitachi SH5+ public final static int IMAGE_FILE_MACHINE_THUMB = 0x1c2; // Thumb+ public final static int IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169; // MIPS little-endian WCE v2+private short machine;private short numberOfSections;private int timeDateStamp;diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.javaindex 36084aaf6c..56d65b881b 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/NTHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/NTHeader.javaindex e88d1fe976..ab035bc2d3 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/NTHeader.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/NTHeader.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -270,7 +270,9 @@ public class NTHeader implements StructConverter, OffsetValidator {fileHeader.processSections(optionalHeader);fileHeader.processSymbols();- fileHeader.processImageRuntimeFunctionEntries();+ if (fileHeader.getMachine() == FileHeader.IMAGE_FILE_MACHINE_AMD64) {+ fileHeader.processImageRuntimeFunctionEntries();+ }if (advancedProcess) {optionalHeader.processDataDirectories(TaskMonitorAdapter.DUMMY_MONITOR);