NationalSecurityAgency/ghidra · error · DataTypeEncodeException
Invalid address
Error message
Invalid address
What it means
TraceRegisterUtils.encodeValueRepresentationHackPointer attempts to encode a string representation into a register value. When the data value class is Address, it tries to parse the representation as an address using the trace's address factory. If getAddress returns null, the string is not a valid address in any known address space, and DataTypeEncodeException is thrown.
Source
Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/util/TraceRegisterUtils.java:233
}
public static TraceData seekComponent(TraceData data, Register reg) {
return seekComponent(data, rangeForRegister(reg));
}
public static RegisterValue encodeValueRepresentationHackPointer(Register register,
TraceData data, String representation) throws DataTypeEncodeException {
DataType dataType = data.getBaseDataType();
if (data.getValueClass() != Address.class) {
byte[] bytes =
dataType.encodeRepresentation(representation, data, data, data.getLength());
BigInteger value = Utils.bytesToBigInteger(bytes, register.getMinimumByteSize(),
register.isBigEndian(), false);
return new RegisterValue(register, value);
}
Address addr = data.getTrace().getBaseAddressFactory().getAddress(representation);
if (addr == null) {
throw new DataTypeEncodeException("Invalid address", representation, dataType);
}
return new RegisterValue(register, addr.getOffsetAsBigInteger());
}
public static RegisterValue combineWithTraceParentRegisterValue(Register parent,
RegisterValue rv, TracePlatform platform, long snap, TraceMemorySpace regs,
boolean requireKnown) {
Register reg = rv.getRegister();
if (reg == parent) {
return rv;
}
if (regs == null) {
if (requireKnown) {
throw new IllegalStateException("Must fetch " + parent + " before setting " + reg);
}
return rv.getRegisterValue(parent);
}
if (requireKnown) {View on GitHub (pinned to d5f144c24d)
Solutions
- Ensure the representation is a valid address string parsable by the trace's AddressFactory
- Check address factory spaces: trace.getBaseAddressFactory().getAddressSpaces() to see valid formats
- Use the correct address format for the space, e.g. 'ram:00401000' or '0000:0001' depending on the architecture
- Validate: trace.getBaseAddressFactory().getAddress(rep) != null before calling
Example fix
// before
RegisterValue rv = TraceRegisterUtils.encodeValueRepresentationHackPointer(
reg, data, "foobar");
// after
RegisterValue rv = TraceRegisterUtils.encodeValueRepresentationHackPointer(
reg, data, "ram:00401000"); Defensive patterns
Strategy: validation
Validate before calling
boolean isValidAddressRepresentation(Trace trace, String rep) {
return trace.getBaseAddressFactory().getAddress(rep) != null;
} Type guard
// N/A
Try / catch
try {
RegisterValue rv = TraceRegisterUtils.encodeValueRepresentationHackPointer(
reg, data, representation);
} catch (DataTypeEncodeException e) {
// address string invalid; show available address spaces
} Prevention
- Validate address strings with AddressFactory.getAddress before encoding
- Check available address spaces in the trace's factory
- Use architecture-appropriate address formats
When it happens
Trigger: Calling encodeValueRepresentationHackPointer with a representation string like 'foobar' or '0xZZZZ' that the address factory cannot parse. The address factory's getAddress method returns null for strings that don't match any space's address format.
Common situations: Setting a register to a pointer value using a malformed address string. Using an address format from a different processor or address space configuration. The trace's address factory doesn't have the space referenced. Typographical errors in the address string. Using a symbol name instead of a raw address.
Related errors
- Must fetch
- Cannot work with sub-byte registers. Consider a parent inste
- Bad address format: {}
- More than one state is present in
- Address string should have at most one colon (:)
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/16d8ffe37f9453f7.
Report an issue: GitHub.