mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-06 09:47:38 +02:00
update _display_value to handle None case
This commit is contained in:
@@ -587,26 +587,43 @@ class Volshell(interfaces.plugins.PluginInterface):
|
||||
|
||||
def _display_value(self, value: Any) -> str:
|
||||
try:
|
||||
# if value is a BaseAbsentValue they display N/A
|
||||
if isinstance(value, interfaces.renderers.BaseAbsentValue):
|
||||
return "N/A"
|
||||
elif isinstance(value, objects.Pointer):
|
||||
# show pointers in hex to match output for struct addrs
|
||||
# highlight null or unreadable pointers
|
||||
if value == 0:
|
||||
suffix = " (null pointer)"
|
||||
elif not value.is_readable():
|
||||
suffix = " (unreadable pointer)"
|
||||
else:
|
||||
suffix = ""
|
||||
return f"{hex(value)}{suffix}"
|
||||
elif isinstance(value, objects.PrimitiveObject):
|
||||
return repr(value)
|
||||
elif isinstance(value, objects.Array):
|
||||
return repr([self._display_value(val) for val in value])
|
||||
else:
|
||||
return hex(value.vol.offset)
|
||||
# volobject branch
|
||||
if isinstance(
|
||||
value,
|
||||
Union[
|
||||
interfaces.objects.ObjectInterface, interfaces.objects.Template
|
||||
],
|
||||
):
|
||||
if isinstance(value, objects.Pointer):
|
||||
# show pointers in hex to match output for struct addrs
|
||||
# highlight null or unreadable pointers
|
||||
if value == 0:
|
||||
suffix = " (null pointer)"
|
||||
elif not value.is_readable():
|
||||
suffix = " (unreadable pointer)"
|
||||
else:
|
||||
suffix = ""
|
||||
return f"{hex(value)}{suffix}"
|
||||
elif isinstance(value, objects.PrimitiveObject):
|
||||
return repr(value)
|
||||
elif isinstance(value, objects.Array):
|
||||
return repr([self._display_value(val) for val in value])
|
||||
else:
|
||||
return hex(value.vol.offset)
|
||||
else:
|
||||
# non volobject
|
||||
if value is None:
|
||||
return "N/A"
|
||||
else:
|
||||
return value
|
||||
|
||||
except exceptions.InvalidAddressException:
|
||||
return "-"
|
||||
# if value causes an InvalidAddressException like BaseAbsentValue then display N/A
|
||||
return "N/A"
|
||||
|
||||
def generate_treegrid(
|
||||
self, plugin: Type[interfaces.plugins.PluginInterface], **kwargs
|
||||
|
||||
Reference in New Issue
Block a user