Improve checks for invalid values

We determine address_masks using log/ln2, which cannot accept 0.
Therefore we don't support address spaces with a maximum_address of 0.
This can affect registry hives, so we've added a check in registry hives
to prevent creating layers with invalid maximum_addresses.
This commit is contained in:
Mike Auty
2017-11-11 15:15:14 +00:00
parent 18f1e5ae90
commit 35d47b0fb0
2 changed files with 7 additions and 1 deletions
+4
View File
@@ -52,3 +52,7 @@ class SymbolSpaceError(VolatilityException):
class LayerException(VolatilityException):
"""Thrown when an error occurs dealing with memory and layers"""
class StructureException(VolatilityException):
"""Thrown when an error occurs dealing with an expected structure type"""
+3 -1
View File
@@ -46,7 +46,9 @@ class RegistryHive(interfaces.layers.TranslationLayerInterface):
self._minaddr = 0
self._maxaddr = self._base_block.Length
# print("MAPPING", self.mapping(self._base_block.RootCell, length = 2))
if self._base_block.Length <= 0:
raise exceptions.StructureException(
"Invalid registry base_block length: {}".format(self._base_block.Length))
@property
def address_mask(self):