Fix uncheck read() call and remove variable that would not be definied if exception triggers

This commit is contained in:
Andrew Case
2024-12-30 18:06:04 +00:00
parent 3211fc1e6c
commit 2153b742a1
@@ -289,7 +289,7 @@ class Skeleton_Key_Check(interfaces.plugins.PluginInterface):
except exceptions.InvalidAddressException as excp:
vollog.debug(
f"Process {proc_id}: invalid address {excp.invalid_address} in layer {excp.layer_name}"
f"Invalid address {excp.invalid_address} in layer {excp.layer_name}"
)
return None, None
@@ -431,15 +431,20 @@ class Skeleton_Key_Check(interfaces.plugins.PluginInterface):
# we do not want to fail just because the count is not in memory
# 16 was the size on samples I tested, so I chose it as the default
count = 16
if target_address:
count = int.from_bytes(
self.context.layers[proc_layer_name].read(
target_address, 4
),
"little",
)
else:
count = 16
try:
count = int.from_bytes(
self.context.layers[proc_layer_name].read(
target_address, 4
),
"little",
)
except exceptions.InvalidAddressException:
vollog.debug(
"Unable to read `cCsystems`. Defaulting to 16."
)
found_count = True