From 34ed11bfc059f1d89a9d9fc689f4a41d0f1a22cc Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Mon, 3 Dec 2018 02:30:19 +0000 Subject: [PATCH] Fix up issue with coalescing sections. --- volatility/framework/interfaces/layers.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/volatility/framework/interfaces/layers.py b/volatility/framework/interfaces/layers.py index 69c88b813..8d103ee40 100644 --- a/volatility/framework/interfaces/layers.py +++ b/volatility/framework/interfaces/layers.py @@ -223,16 +223,17 @@ class DataLayerInterface(configuration.ConfigurableInterface, validity.ValidityR "\n".join(traceback.TracebackException.from_exception(e).format(chain = True))) def _coalesce_sections(self, - sections: typing.Iterable[typing.Tuple[int, int]]) -> typing.Iterable[ - typing.Tuple[int, int]]: + sections: typing.Iterable[typing.Tuple[int, int]]) \ + -> typing.Iterable[typing.Tuple[int, int]]: + """Take a list of (start, length) sections and coalesce any adjacent sections""" result = [] # type: typing.List[typing.Tuple[int, int]] position = 0 for (start, length) in sorted(sections): - if not result: - result.append((start, length)) - if start < position: + if result and start <= position: initial_start, _ = result.pop() result.append((initial_start, (start + length) - initial_start)) + else: + result.append((start, length)) position = start + length while result and result[0] < (self.minimum_address, 0):