From c7a19f88d9f3a12bb8c9bfc7b903d7ccfb2b6ccb Mon Sep 17 00:00:00 2001 From: mjklbhvg <83467290+mjklbhvg@users.noreply.github.com> Date: Thu, 2 May 2024 00:52:57 +0200 Subject: [PATCH] Extend the test for `gef.memory.parse_gdb_info_proc_maps()` The offsets parsed are now checked against the offsets in `/proc/PID/maps`. --- tests/api/gef_memory.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/api/gef_memory.py b/tests/api/gef_memory.py index d771b1038..19d2d350b 100644 --- a/tests/api/gef_memory.py +++ b/tests/api/gef_memory.py @@ -75,8 +75,11 @@ def test_api_gef_memory_parse_info_proc_maps(self): next(root.eval("gef.memory.parse_gdb_info_proc_maps()") ) else: - for section in root.eval("gef.memory.parse_gdb_info_proc_maps()"): - assert isinstance(section, Section) + sections = list(root.eval("gef.memory.parse_gdb_info_proc_maps()")) + with open(f"/proc/{gef.session.pid}/maps") as f: + for section, line in zip(sections, f.read().splitlines()): + assert isinstance(section, Section) + assert section.offset == int(line.split()[2], 16) def test_func_parse_permissions(self): root = self._conn.root