From 074768901f3cdc8205b61773fb1faf6f6c7b3ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E4=BD=B3=E6=B5=A9Alben?= <35291372+XiaoBinGan@users.noreply.github.com> Date: Tue, 20 Oct 2026 16:12:55 +0800 Subject: [PATCH] fix(pwndbg): separate the words in the debugger-context limit message (#5372) The 64 MiB reply-budget refusal rendered as "exceeds64 MiB" because the message word and the limit were joined. The pwntools sibling names the same budget as "exceeds the 64 MiB reply budget"; use that wording. The output-limit path had no producer regression, so the pwndbg suite gains one that drives the real 64 MiB boundary, and the suite is now part of test:python instead of running only when invoked by hand. Co-authored-by: XiaoBinGan --- bridge/pwndbg/core_context.py | 2 +- bridge/pwndbg/test_core_context.py | 13 +++++++++++-- package.json | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bridge/pwndbg/core_context.py b/bridge/pwndbg/core_context.py index 498c89b3b6..ffdbc72ab4 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 95f5611733..3e61455a91 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 5f77580431..e154ff398a 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",