diff --git a/volatility/framework/interfaces/objects.py b/volatility/framework/interfaces/objects.py index 548799951..50e0379ba 100644 --- a/volatility/framework/interfaces/objects.py +++ b/volatility/framework/interfaces/objects.py @@ -169,7 +169,7 @@ class ObjectInterface(validity.ValidityRoutines, metaclass = ABCMeta): @classmethod def relative_child_offset(cls, template: 'Template', - child: 'Template') -> int: + child: str) -> int: """Returns the relative offset from the head of the parent data to the child member""" raise KeyError("Template does not contain any children: {}".format(template.vol.type_name)) @@ -223,7 +223,7 @@ class Template(validity.ValidityRoutines): """Returns the size of the template""" @abstractmethod - def relative_child_offset(self, child: 'Template') -> int: + def relative_child_offset(self, child: str) -> int: """Returns the relative offset of the `child` member from its parent offset""" @abstractmethod diff --git a/volatility/framework/objects/__init__.py b/volatility/framework/objects/__init__.py index ac16e6133..c4fb5d03c 100644 --- a/volatility/framework/objects/__init__.py +++ b/volatility/framework/objects/__init__.py @@ -456,9 +456,9 @@ class Array(interfaces.objects.ObjectInterface, abc.Sequence): @classmethod def relative_child_offset(cls, template: interfaces.objects.Template, - child: interfaces.objects.Template) -> int: + child: str) -> int: """Returns the relative offset from the head of the parent data to the child member""" - if 'subtype' in template and child == 'subtype': + if 'subtype' in template.vol and child == 'subtype': return 0 raise IndexError("Member not present in array template: {}".format(child)) @@ -551,7 +551,7 @@ class Struct(interfaces.objects.ObjectInterface): @classmethod def relative_child_offset(cls, template: interfaces.objects.Template, - child: interfaces.objects.Template) -> int: + child: str) -> int: """Returns the relative offset of a child to its parent""" retlist = template.vol.members.get(child, None) if retlist is None: diff --git a/volatility/framework/objects/templates.py b/volatility/framework/objects/templates.py index a131a489c..ba17a8180 100644 --- a/volatility/framework/objects/templates.py +++ b/volatility/framework/objects/templates.py @@ -36,7 +36,7 @@ class ObjectTemplate(interfaces.objects.Template, validity.ValidityRoutines): """ return self.vol.object_class.VolTemplateProxy.children(self) - def relative_child_offset(self, child: interfaces.objects.Template) -> int: + def relative_child_offset(self, child: str) -> int: """Returns the relative offset of a child of the templated object (see :class:`~volatility.framework.interfaces.objects.ObjectInterface.VolTemplateProxy`) """ return self.vol.object_class.VolTemplateProxy.relative_child_offset(self, child)