hexdump: check if address is valid (#2833)

pull/2838/head
davi 8 months ago committed by GitHub
parent 97ea040b1a
commit 107a8f1bac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -77,6 +77,9 @@ def hexdump(address, count=pwndbg.config.hexdump_bytes) -> None:
hexdump.offset = 0
address = int(address)
if not pwndbg.aglib.memory.peek(address):
print("Could not read memory at specified address")
return
if address > pwndbg.aglib.arch.ptrmask:
new_address = address & pwndbg.aglib.arch.ptrmask
print(

@ -21,7 +21,7 @@ def run_tests(stack, use_big_endian, expected):
# Test empty hexdump
result = gdb.execute("hexdump 0", to_string=True)
assert result == "+0000 0x000000 \n"
assert result == "Could not read memory at specified address\n"
results = []
# TODO: Repetition is not working in tests

Loading…
Cancel
Save