You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7c0a412
Browse filesBrowse the repository at this point in the historyBrowse files
# next points to address 0xFF..FF which is out of bounds
58
+
memory =b"\x0a\x00\x00\x00"+b"\xff"*8
58
59
node = node_t.from_bytes(memory)
59
60
60
61
result = node.next.try_unwrap()
61
62
print(result) # None
62
63
```
63
64
65
+
!!! note
66
+
A null pointer (address 0) is **not** automatically invalid — address 0 is a valid index in Python byte sequences. `try_unwrap()` only returns `None` when the address causes an `IndexError` or `ValueError` during resolution.
67
+
64
68
## Self-Referential Structs
65
69
66
70
Use `ptr["TypeName"]` for self-referential structs:
@@ -94,16 +98,16 @@ import struct as pystruct
94
98
# Node 0 at offset 0: val=10, next -> offset 12
95
99
memory[0:4] = pystruct.pack("<i", 10)
96
100
memory[4:12] = pystruct.pack("<q", 12)
97
-
# Node 1 at offset 12: val=20, next -> null
101
+
# Node 1 at offset 12: val=20, next -> out of bounds
0 commit comments