-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
Describe the bug
A ProgramLocation
that has an address in the EXTERNAL_SPACE
AddressSpace
will not restore properly using ProgramLocation.restoreState()
.
The underlying problem is a few levels deep. ProgramLocation.restoreState()
calls ProgramUtilities.parseAddress()
, which calls ProgramDB.parseAddress()
. This ends up calling DefaultAddressFactory.getAllAddresses()
. This loops over a set of AddressSpace
s that includes EXTERNAL_SPACE
, but ignores it because space.isMemorySpace()
is false
for that space. There is a comment here that reads:
for (AddressSpace space : spaces) {
// Only parse against true physical spaces first
if (space.isMemorySpace()) {
but the code never goes back and checks the non physical spaces. As a result, the external address string (which looks like EXTERNAL:00000001
) never parses correctly, causing ProgramLocation.restoreState()
to fail.
To Reproduce
In code, call ProgramLocation.saveState()
on a ProgramLocation
that refers to an external address. Then attempt to call ProgramLocation.restoreState()
on that SaveState
.
Expected behavior
Restoring ProgramLocation
s that have non-physical addresses should succeed.
Screenshots
If applicable, add screenshots to help explain your problem.
Attachments
If applicable, please attach any files that caused problems or log files generated by the software.
Environment (please complete the following information):
- OS: Linux 5.14
- Java Version: openjdk 21.0.8 2025-07-15 LTS
- Ghidra Version: 11.3.1
- Ghidra Origin: https://github.com/NationalSecurityAgency/ghidra/releases