From d969d89da96ded963c87c81fe091d8674a9e8778 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Thu, 5 Dec 2019 00:27:48 +0000 Subject: [PATCH] Objects: Ensure array sizes change with their count --- volatility/framework/objects/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/volatility/framework/objects/__init__.py b/volatility/framework/objects/__init__.py index 5a374818f..b13bc3039 100644 --- a/volatility/framework/objects/__init__.py +++ b/volatility/framework/objects/__init__.py @@ -495,6 +495,7 @@ class Array(interfaces.objects.ObjectInterface, abc.Sequence): super().__init__(context = context, type_name = type_name, object_info = object_info) self._vol['count'] = count self._vol['subtype'] = subtype + self._vol['size'] = count * subtype.size # This overrides the little known Sequence.count(val) that returns the number of items in the list that match val # Changing the name would be confusing (since we use count of an array everywhere else), so this is more important @@ -507,6 +508,7 @@ class Array(interfaces.objects.ObjectInterface, abc.Sequence): def count(self, value: int) -> None: """Sets the count to a specific value.""" self._vol['count'] = value + self._vol['size'] = value * self._vol['subtype'].size class VolTemplateProxy(interfaces.objects.ObjectInterface.VolTemplateProxy):