{"record":{"id":"16d8ffe37f9453f7","repo":"NationalSecurityAgency/ghidra","slug":"invalid-address","errorCode":null,"errorMessage":"Invalid address","messagePattern":"Invalid address","errorType":"exception","errorClass":"DataTypeEncodeException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/util/TraceRegisterUtils.java","lineNumber":233,"sourceCode":"\t}\n\n\tpublic static TraceData seekComponent(TraceData data, Register reg) {\n\t\treturn seekComponent(data, rangeForRegister(reg));\n\t}\n\n\tpublic static RegisterValue encodeValueRepresentationHackPointer(Register register,\n\t\t\tTraceData data, String representation) throws DataTypeEncodeException {\n\t\tDataType dataType = data.getBaseDataType();\n\t\tif (data.getValueClass() != Address.class) {\n\t\t\tbyte[] bytes =\n\t\t\t\tdataType.encodeRepresentation(representation, data, data, data.getLength());\n\t\t\tBigInteger value = Utils.bytesToBigInteger(bytes, register.getMinimumByteSize(),\n\t\t\t\tregister.isBigEndian(), false);\n\t\t\treturn new RegisterValue(register, value);\n\t\t}\n\t\tAddress addr = data.getTrace().getBaseAddressFactory().getAddress(representation);\n\t\tif (addr == null) {\n\t\t\tthrow new DataTypeEncodeException(\"Invalid address\", representation, dataType);\n\t\t}\n\t\treturn new RegisterValue(register, addr.getOffsetAsBigInteger());\n\t}\n\n\tpublic static RegisterValue combineWithTraceParentRegisterValue(Register parent,\n\t\t\tRegisterValue rv, TracePlatform platform, long snap, TraceMemorySpace regs,\n\t\t\tboolean requireKnown) {\n\t\tRegister reg = rv.getRegister();\n\t\tif (reg == parent) {\n\t\t\treturn rv;\n\t\t}\n\t\tif (regs == null) {\n\t\t\tif (requireKnown) {\n\t\t\t\tthrow new IllegalStateException(\"Must fetch \" + parent + \" before setting \" + reg);\n\t\t\t}\n\t\t\treturn rv.getRegisterValue(parent);\n\t\t}\n\t\tif (requireKnown) {","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/util/TraceRegisterUtils.java#L215-L251","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nRegisterValue rv = TraceRegisterUtils.encodeValueRepresentationHackPointer(\n    reg, data, \"foobar\");\n// after\nRegisterValue rv = TraceRegisterUtils.encodeValueRepresentationHackPointer(\n    reg, data, \"ram:00401000\");","handlingStrategy":"validation","validationCode":"boolean isValidAddressRepresentation(Trace trace, String rep) {\n    return trace.getBaseAddressFactory().getAddress(rep) != null;\n}","typeGuard":"// N/A","tryCatchPattern":"try {\n    RegisterValue rv = TraceRegisterUtils.encodeValueRepresentationHackPointer(\n        reg, data, representation);\n} catch (DataTypeEncodeException e) {\n    // address string invalid; show available address spaces\n}","preventionTips":["Validate address strings with AddressFactory.getAddress before encoding","Check available address spaces in the trace's factory","Use architecture-appropriate address formats"],"tags":["ghidra","trace-utils","register","address","encoding"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}