NationalSecurityAgency/ghidra · error · MemoryAccessException
Guest address ${addr} is not mapped, or the mapped address d
Error message
Guest address ${addr} is not mapped, or the mapped address does not exist in host memory What it means
getByte reads one byte via getBytes(addr, val); if zero bytes were returned it throws MemoryAccessException naming the guest address: "Guest address X is not mapped, or the mapped address does not exist in host memory". Either no guest-to-host mapping covers the address, or a mapping exists but the host side has no backing memory for the snapshot.
Source
Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/DBTraceGuestPlatformMappedMemory.java:392
return buffer.position() - startPos;
}
protected ByteBuffer getBytesInFull(Address address, int len) throws MemoryAccessException {
ByteBuffer buf = ByteBuffer.allocate(len);
if (getBytes(buf, address) != len) {
throw new MemoryAccessException("Could not read enough bytes");
}
if (!isBigEndian()) {
buf.order(ByteOrder.LITTLE_ENDIAN);
}
return buf;
}
@Override
public byte getByte(Address addr) throws MemoryAccessException {
byte[] val = new byte[1];
if (getBytes(addr, val) < 1) {
throw new MemoryAccessException("Guest address " + addr.toString() +
" is not mapped, or the mapped address does not exist in host memory");
}
return val[0];
}
@Override
public int getBytes(Address addr, byte[] dest) throws MemoryAccessException {
return getBytes(addr, dest, 0, dest.length);
}
@Override
public int getBytes(Address addr, byte[] dest, int destIndex, int size)
throws MemoryAccessException {
return getBytes(ByteBuffer.wrap(dest, destIndex, size), addr);
}
@Override
public short getShort(Address addr) throws MemoryAccessException {View on GitHub (pinned to d5f144c24d)
Solutions
- Confirm a mapping exists for the address and that host memory is populated for the snapshot before reading.
- Add the missing mapping and/or write host bytes for the snapshot.
- Catch MemoryAccessException and treat the address as unmapped.
Example fix
// before
byte b = guestMem.getByte(addr);
// after
try {
byte b = guestMem.getByte(addr);
} catch (MemoryAccessException e) {
// unmapped or unmapped host backing: handle gracefully
} Defensive patterns
Strategy: try-catch
Validate before calling
// confirm a mapping covers the address and host memory is populated
if (platform.mapGuestToHost(addr) == null) { /* unmapped; skip */ } Try / catch
try { byte b = guestMem.getByte(addr); }
catch (MemoryAccessException e) { /* unmapped guest or missing host backing */ } Prevention
- Establish and verify guest-to-host mappings before emulation reads.
- Populate host memory for the active snapshot before reading guest addresses.
- Catch MemoryAccessException at emulation boundaries to model unmapped access.
When it happens
Trigger: Reading a guest address outside any addMappedRange; reading inside a mapping whose host address has no written memory for the current snapshot.
Common situations: Emulation touching unmapped guest memory; querying before host memory has been populated for the snapshot; stale mappings after host memory was cleared.
Related errors
- Could not read enough bytes
- Register {register} is not mapped
- Space does not exist
- %s: %s
- Failed to read memory
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/3192ab6ebaba8cd1.
Report an issue: GitHub.