From f6a22eed05a7ba3784df47df77c0d8f8643e9f8c Mon Sep 17 00:00:00 2001 From: Gustavo Moreira Date: Thu, 30 Jan 2025 18:44:18 +1100 Subject: [PATCH] linux: vmcoreinfo API: significantly improve the performance when validating each character, from O(n) to O(1).. where n is 100 chars long --- volatility3/framework/symbols/linux/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/volatility3/framework/symbols/linux/__init__.py b/volatility3/framework/symbols/linux/__init__.py index 846928c3a..afdfee39c 100644 --- a/volatility3/framework/symbols/linux/__init__.py +++ b/volatility3/framework/symbols/linux/__init__.py @@ -903,7 +903,8 @@ class VMCoreInfo(interfaces.configuration.VersionableInterface): """Converts the input VMCoreInfo data buffer into a dictionary""" # Ensure the whole buffer is printable - if not all(char in string.printable.encode() for char in vmcoreinfo_data): + printable_bytes_set = set(string.printable.encode()) + if not all(byte in printable_bytes_set for byte in vmcoreinfo_data): # Abort, we are in the wrong place return None