Windows Registry: Handle possible exception in get_node

Encountered a `SwappedInvalidAddressException` within the call to `cast`
due to an underlying call to `read`.
This commit is contained in:
David McDonald
2024-12-30 14:29:20 -06:00
parent 3eeb10be29
commit f3294ef5f1
+8 -1
View File
@@ -140,7 +140,14 @@ class RegistryHive(linear.LinearlyMappedLayer):
"""Returns the appropriate Node, interpreted from the Cell based on its
Signature."""
cell = self.get_cell(cell_offset)
signature = cell.cast("string", max_length=2, encoding="latin-1")
try:
signature = cell.cast("string", max_length=2, encoding="latin-1")
except exceptions.InvalidAddressException:
vollog.debug(
f"Unable to read cell signature for cell at {cell.vol.offset:x}"
)
return cell
if signature == "nk":
return cell.u.KeyNode
elif signature == "sk":