NationalSecurityAgency/ghidra · critical · IOException

Table is corrupt. Got host platform in guest mapping.

Error message

Table is corrupt. Got host platform in guest mapping.

What it means

When loading a stored DBTraceGuestPlatformMappedRange, fresh() resolves the guest platform by key via manager.getPlatformByKey(guestPlatformKey); if platform.isHost() it throws IOException("Table is corrupt. Got host platform in guest mapping."). A mapped-range row references the host platform where only a guest platform is valid, so the row is internally inconsistent.

Source

Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/DBTraceGuestPlatformMappedRange.java:94

			DBRecord r) {
		super(s, r);
		this.manager = manager;
	}

	@Override
	protected void fresh(boolean created) throws IOException {
		super.fresh(created);
		if (created) {
			return;
		}
		this.hostSpace = manager.trace.getBaseAddressFactory().getAddressSpace(hostSpaceID);
		Address hostStart = hostSpace.getAddress(hostOffset);
		Address hostEnd = hostStart.addWrap(length - 1);
		this.hostRange = new AddressRangeImpl(hostStart, hostEnd);

		InternalTracePlatform platform = manager.getPlatformByKey(guestPlatformKey);
		if (platform.isHost()) {
			throw new IOException("Table is corrupt. Got host platform in guest mapping.");
		}
		this.platform = (DBTraceGuestPlatform) platform;
		this.guestSpace = platform.getAddressFactory().getAddressSpace(guestSpaceID);
		Address guestStart = guestSpace.getAddress(guestOffset);
		Address guestEnd = guestStart.addWrap(length - 1);
		this.guestRange = new AddressRangeImpl(guestStart, guestEnd);

		this.shiftHostToGuest = guestStart.getOffset() - hostStart.getOffset();
	}

	void set(Address hostStart, DBTraceGuestPlatform platform, Address guestStart, long length) {
		this.hostSpace = hostStart.getAddressSpace();
		this.hostSpaceID = hostSpace.getSpaceID();
		this.hostOffset = hostStart.getOffset();
		this.guestPlatformKey = (int) platform.getKey();
		this.guestSpace = guestStart.getAddressSpace();
		this.guestSpaceID = guestSpace.getSpaceID();
		this.guestOffset = guestStart.getOffset();

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Restore the trace from a known-good backup.
  2. Rebuild the guest platform and its mappings from scratch.
  3. Report as corruption; there is no runtime workaround that can rehydrate an inconsistent row.
Defensive patterns

Strategy: try-catch

Validate before calling

// no runtime preflight: detect by validating DB integrity off-line
// (a mapped-range row must not reference the host platform key)

Try / catch

try { trace.open(...); }
catch (IOException e) {
    if (e.getMessage().contains("Got host platform in guest mapping")) { /* corrupt DB; restore backup */ }
    else throw e;
}

Prevention

When it happens

Trigger: Corrupt DB where a mapped-range row's guestPlatformKey points at the host platform key; tampered or partially-written table from a crash during write; schema bug writing the wrong key.

Common situations: Hand-edited DB; crash leaving half-written rows; bug in platform key assignment producing the host key in a guest-mapping row.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/b4bbea04cc41d641. Report an issue: GitHub.