Open cubictriangle opened 1 month ago
Do you know if this is a unique feature of just the Import Table Data Directory, or do other Data Directories ignore the size too?
Do you know if this is a unique feature of just the Import Table Data Directory, or do other Data Directories ignore the size too?
I am not really sure about that. The official PE Format document explicit said that the Import Data Directory is null-terminated. Quote From doc: "The last directory entry is empty (filled with null values), which indicates the end of the directory table." https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#the-idata-section I do not see it mentions other Data Directories have this feature. You can modify the size values for other Data Directories and see what happens. If the program runs fine, it means that the version of Windows you are using ignores the size.
I test the Export Table Data Directory on Windows 10, by setting the size to 0 and 0xFF FF FF FF, the program works fine. But when I modify the size of IAT Data Directories, it fails.
Describe the bug Ghidra cannot load the import table if the size value in optional header is too big. But Windows Operating System do not use the size value in optional header to decide the size of the import table. The import table is null-terminated, OS will stop loading when it find an all 0 import directory.
To Reproduce Steps to reproduce the behavior:
Expected behavior "Imports" in "Symbol Tree" should shows imported libraries and functions. IAT should shows the libraries and functions name. When calling import function, CALL instructions should be followed by the libraries and functions name.
Screenshots This is what Ghidra should be:![should-be](https://github.com/NationalSecurityAgency/ghidra/assets/115812485/4fe2c57e-f5ee-41ed-8790-c40b39c8e509)
This is what it actually looks:![actually-looks](https://github.com/NationalSecurityAgency/ghidra/assets/115812485/f2e72360-9068-4831-bdf9-e415e9921d56)
The only difference is the value of import table size in optional header. And this program can run just fine.![ninja-too-big-import-table-size](https://github.com/NationalSecurityAgency/ghidra/assets/115812485/c86d5219-8b05-423e-a864-bf3959249f51)
Attachments None
Environment (please complete the following information):
Additional context None