Skip to content

ProgramLocations referring to external symbols cannot be restored from a SaveState #8503

@sei-mwd

Description

@sei-mwd

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 AddressSpaces 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 ProgramLocations 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):

Metadata

Metadata

Assignees

Labels

Status: TriageInformation is being gathered

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions