Add in better support for sorting BaseAbsentValues.

This commit is contained in:
Mike Auty
2019-08-31 22:01:01 +01:00
parent 39c4d061a1
commit 5d75d617b3
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -98,9 +98,9 @@ class Disassembly(object):
# contain the types that the validator will accept (which would not include the base)
_Type = TypeVar("_Type", bound = Type)
ColumnsType = List[Tuple[str, Type]]
BaseTypes = Union[Type[int], Type[str], Type[float], Type[bytes], Type[datetime.datetime], Type[BaseAbsentValue],
Type[Disassembly]]
ColumnsType = List[Tuple[str, BaseTypes]]
VisitorSignature = Callable[[TreeNode, _Type], _Type]
+8 -1
View File
@@ -9,6 +9,7 @@ import datetime
from typing import Any, Callable, Iterable, List, Optional, Tuple, TypeVar, Union
from volatility.framework import interfaces
from volatility.framework.interfaces import renderers
class UnreadableValue(interfaces.renderers.BaseAbsentValue):
@@ -331,6 +332,12 @@ class ColumnSortKey(interfaces.renderers.ColumnSortKey):
if isinstance(value, interfaces.renderers.BaseAbsentValue):
if self._type == datetime.datetime:
value = datetime.datetime.min
elif self._type == int:
elif self._type in [int, float]:
value = -1
elif self._type == bool:
value = False
elif self._type in [str, renderers.Disassembly]:
value = "-"
elif self._type == bytes:
value = b""
return value