-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Open
Labels
Description
Ghidra's C preprocessor grabs the wrong file when a file of the same name exists in the include path.
To Reproduce
- Create a directory with the following structure:
- /a.h
- /include_a
- foo.h
- /include_b
- foo.h
- Contents of a.h:
#include "include_b\foo.h" - Contents of include_a/foo.h:
#error this should not be included - include_b/foo.h can be empty
- Create a parse configuration that has include_a as an include path and a.h as the sole file to parse, and no parse options. I don't think the program architecture matters, but x86:LE:64:default / gcc will reproduce this issue.
- Parse (either to program or to file)
Error message:
No Data Types added.
PreProcessor Messages:
...\include_a\foo.h
...\include_a\foo.h'1 #error Error: this should not be included
In file foo.h
ERROR parsing Included File: PreProcessor hit #error " this should not be included"
In file ...\a.h
PreProcessor Parse Error: PreProcessor hit #error " this should not be included"
Expected behavior
A successful parse (with no data types, since nothing was defined in the parsed file).
Attachments
bad_include.gdt_CParser.txt
Environment
- OS: Windows 11
- Java Version: java 21.0.5 2024-10-15 LTS
- Ghidra Version: 11.4.2 and 11.3.1
- Ghidra Origin: official GitHub distro