Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(pwndbg): separate the words in the debugger-context limit message (#5372)

吴佳浩Alben074768901f3c
diff --git a/bridge/pwndbg/core_context.py b/bridge/pwndbg/core_context.py
index 498c89b3b..ffdbc72ab 100644
--- a/bridge/pwndbg/core_context.py
+++ b/bridge/pwndbg/core_context.py
@@ -95,7 +95,7 @@ def main():
try:
encoded = json.dumps(reply, ensure_ascii=True, allow_nan=False).encode("utf-8")
if len(encoded) > OUTPUT_BYTES:
- encoded = json.dumps({"ok": False, "reason": "output-limit", "message": "Complete debugger context exceeds64 MiB reply budget."}).encode("utf-8")
+ encoded = json.dumps({"ok": False, "reason": "output-limit", "message": "Complete debugger context exceeds the 64 MiB reply budget."}).encode("utf-8")
descriptor = os.open(request["reply_path"], os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
with os.fdopen(descriptor, "wb") as handle:
handle.write(encoded)
diff --git a/bridge/pwndbg/test_core_context.py b/bridge/pwndbg/test_core_context.py
index 95f561173..3e61455a9 100644
--- a/bridge/pwndbg/test_core_context.py
+++ b/bridge/pwndbg/test_core_context.py
@@ -14,7 +14,7 @@ BRIDGE = Path(__file__).with_name("core_context.py")
class CoreContextTests(unittest.TestCase):
- def inspect(self, failure=None, connection="core", symbols=None, architecture="x86_64-little-endian"):
+ def inspect(self, failure=None, connection="core", symbols=None, architecture="x86_64-little-endian", objfile="recorded-executable"):
commands, reads, queries = [], [], []
state = {"executable": None, "symbols": None, "connection": None}
gdb = types.ModuleType("gdb")
@@ -50,7 +50,7 @@ class CoreContextTests(unittest.TestCase):
def maps():
self.assertIsNone(state["executable"], "Helper executable must be discarded before mapping queries")
queries.append("maps")
- return [types.SimpleNamespace(start=4096, end=8192, offset=0, flags=5, objfile="recorded-executable")]
+ return [types.SimpleNamespace(start=4096, end=8192, offset=0, flags=5, objfile=objfile)]
pwndbg.aglib.vmmap.get = maps
modules = {module.__name__: module for module in [
@@ -104,6 +104,15 @@ class CoreContextTests(unittest.TestCase):
self.assertEqual(reads, [])
self.assertEqual(queries, [])
+ def test_output_limit_message_separates_the_words_and_names_the_limit(self):
+ result, _, reads, queries = self.inspect(objfile="m" * (64 * 1024 * 1024))
+ self.assertFalse(result["ok"])
+ self.assertEqual(result["reason"], "output-limit")
+ self.assertNotIn("exceeds64", result["message"])
+ self.assertEqual(result["message"], "Complete debugger context exceeds the 64 MiB reply budget.")
+ self.assertEqual(reads, [])
+ self.assertEqual(queries, ["maps"])
+
def test_wrong_connection_or_remaining_symbols_never_queries_mappings(self):
for options in [{"connection": "native"}, {"symbols": "unexpected-symbols"}]:
with self.subTest(options=options):
diff --git a/package.json b/package.json
index 5f7758043..e154ff398 100644
--- a/package.json
+++ b/package.json
@@ -139,7 +139,7 @@
"test": "npm run test:with-build",
"test:with-build": "npm run test:prepare && vitest run",
"test:run": "vitest run",
- "test:python": "python3 -m unittest bridge/native/test_rea_lldb_tracer.py bridge/mitmproxy/test_capture.py -v && python3 -m unittest discover -s experiments/analysis-efficiency -p 'test_*.py' -v",
+ "test:python": "python3 -m unittest bridge/native/test_rea_lldb_tracer.py bridge/pwndbg/test_core_context.py bridge/mitmproxy/test_capture.py -v && python3 -m unittest discover -s experiments/analysis-efficiency -p 'test_*.py' -v",
"test:local": "node scripts/run-development-tests.mjs local",
"test:fast": "node scripts/ci/test-group.mjs source",
"test:built": "node scripts/ci/test-group.mjs built",