{"record":{"id":"b7ce1aa19335326e","repo":"NationalSecurityAgency/ghidra","slug":"address-string-should-have-at-most-one-colon","errorCode":null,"errorMessage":"Address string should have at most one colon (:)","messagePattern":"Address string should have at most one colon \\(:\\)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceStaticMapping.java","lineNumber":58,"sourceCode":" * <ul>\n * <li>1: Change {@link #traceAddress} to 10-byte fixed encoding</li>\n * <li>0: Initial version and previous unversioned implementation</li>\n * </ul>\n */\n@DBAnnotatedObjectInfo(version = 1)\npublic class DBTraceStaticMapping extends DBAnnotatedObject\n\t\timplements TraceStaticMapping, DecodesAddresses {\n\tpublic static final String TABLE_NAME = \"StaticMappings\";\n\n\tprotected static String parseSpace(String addrStr) {\n\t\tString[] parts = addrStr.split(\":\");\n\t\tif (parts.length == 1) {\n\t\t\treturn null;\n\t\t}\n\t\tif (parts.length == 2) {\n\t\t\treturn parts[0];\n\t\t}\n\t\tthrow new IllegalArgumentException(\"Address string should have at most one colon (:)\");\n\t}\n\n\tprotected static long parseOffset(String addrStr) {\n\t\tString[] parts = addrStr.split(\":\");\n\t\tassert parts.length <= 2;\n\t\treturn Long.parseUnsignedLong(parts[parts.length - 1], 16); // TODO: Use BigInteger?\n\t}\n\n\tstatic final String TRACE_ADDRESS_COLUMN_NAME = \"TraceAddress\";\n\tstatic final String LENGTH_COLUMN_NAME = \"Length\";\n\tstatic final String START_SNAP_COLUMN_NAME = \"StartSnap\";\n\tstatic final String END_SNAP_COLUMN_NAME = \"EndSnap\";\n\tstatic final String STATIC_PROGRAM_COLUMN_NAME = \"StaticProgram\";\n\tstatic final String STATIC_ADDRESS_COLUMN_NAME = \"StaticAddress\";\n\n\t@DBAnnotatedColumn(TRACE_ADDRESS_COLUMN_NAME)\n\tstatic DBObjectColumn TRACE_ADDRESS_COLUMN;\n\t@DBAnnotatedColumn(LENGTH_COLUMN_NAME)","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceStaticMapping.java#L40-L76","documentation":"Thrown by DBTraceStaticMapping.parseSpace when an address string contains more than one colon character. Ghidra's trace static-mapping address format is 'space:offset' (space name + hex offset) or just 'offset' (hex offset with no space). More than one colon makes the string ambiguous and unparseable.","triggerScenarios":"Passing a staticAddress or traceAddress string with two or more colons to DBTraceStaticMapping.set or any code path that calls parseSpace/parseOffset (e.g. DBTraceStaticMappingManager.add with a malformed toAddress).","commonSituations":"Using a full URL-like string ('file:/path:offset') instead of the expected 'space:offset' format. Including a namespace separator or port-style colon in the offset. Passing an address from another tool that embeds colons.","solutions":["Format static addresses as 'spaceName:hexOffset' or plain 'hexOffset' only, ensuring at most one colon.","Strip protocol/host prefixes from URLs before building the address string; only pass the address-space-and-offset portion.","Validate with addrStr.split(\":\").length <= 2 before calling the mapping API."],"exampleFix":"// before\nString staticAddress = \"ram:0x00401000:extra\";\nmappingManager.add(range, lifespan, programURL, staticAddress);\n\n// after\nString staticAddress = \"ram:00401000\";\nmappingManager.add(range, lifespan, programURL, staticAddress);","handlingStrategy":"validation","validationCode":"// Ensure the address string has at most one colon before passing to mapping APIs\nstatic String sanitizeAddr(String addrStr) {\n    long colons = addrStr.chars().filter(c -> c == ':').count();\n    if (colons > 1) {\n        throw new IllegalArgumentException(\"Address has \" + colons + \" colons: \" + addrStr);\n    }\n    return addrStr;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Format static addresses as 'space:hexOffset' with at most one colon.","Strip URL protocol/host prefixes before building the address string.","Validate colons count before calling mapping APIs."],"tags":["trace-modeling","mapping","address","parsing","validation","ghidra"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}