Repository navigation
fix(cutter): keep exact digits of 64-bit JSON integers - #10337
rudycelekli wants to merge 1 commit into
Conversation
[Medium impact] The PR appears safe to merge; the remaining request for number-boundary tests is non-blocking. Findings
Fix with agent prompt### Issue 1
tests/boundary/providers/CutterBridgeClient.test.ts:880-883
The new regression covers large positive integers but leaves the conversion boundary and float exclusion untested. Add raw-response cases for `9007199254740991`, `9007199254740992`, `-9007199254740993`, `9007199254740992.0`, and `1e20`. Assert that only unsafe integer literals become strings. Otherwise, a later parser change could alter floats or mishandle the cutoff without failing this regression.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryPreserves large JSON integer literals as exact decimal strings when reading authenticated Cutter responses.
Source review found no new actionable issue or security concern. Tests were not run during this review. Checking whether another PR supersedes this one was blocked by unavailable GitHub authentication. Reviews (3) · Last reviewed commit: "fix(cutter): keep exact digits of 64-bit..." · Reviewed by Greptile |
| const aflj = | ||
| '[{"offset":18446744071578845304,"name":"entry0","size":8,' + | ||
| '"minbound":18446744071578845304,"maxbound":18446744071578845312,' + | ||
| '"stackframe":8,"nbbs":1}]'; |
There was a problem hiding this comment.
The new regression covers large positive integers but leaves the conversion boundary and float exclusion untested. Add raw-response cases for 9007199254740991, 9007199254740992, -9007199254740993, 9007199254740992.0, and 1e20. Assert that only unsafe integer literals become strings. Otherwise, a later parser change could alter floats or mishandle the cutoff without failing this regression.
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/boundary/providers/CutterBridgeClient.test.ts
Line: 880-883
Comment:
**Number boundaries lack tests**
The new regression covers large positive integers but leaves the conversion boundary and float exclusion untested. Add raw-response cases for `9007199254740991`, `9007199254740992`, `-9007199254740993`, `9007199254740992.0`, and `1e20`. Assert that only unsafe integer literals become strings. Otherwise, a later parser change could alter floats or mishandle the cutoff without failing this regression.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
cutter_commandwithjson: truerounded Rizin integers above 2^53. Rizin prints unsigned 64-bit addresses in decimal, so on a kernel or other high-half imageaflj,pdjandiejreturned wrong addresses. For example, the real offset0xffffffff81000078came back as18446744071578845000, which is0xffffffff81000000, the image base. Cutter'scmdjisjson.loads(cmd(command))(src/python/cutter.py), and the bridge writes Python ints exactly. The loss happened only at the client's finalJSON.parse. No open issue or PR matches this.Problem and expected behavior
Smallest trigger: open an x86-64 ELF whose PT_LOAD is at
0xffffffff81000000and runafljwithjson: true. Real Rizin 0.9.1 output:[{"offset":18446744071578845304,"name":"entry0","size":8,...,"minbound":18446744071578845304,"maxbound":18446744071578845312,...}]Before:
offset,minboundandmaxboundall became18446744071578845000, so the function's start and end were reported as the same address. After: integer literals that a JavaScript number cannot hold exactly are returned as decimal strings with the producer's digits ("18446744071578845304"). Safe integers, floats and every other value are unchanged.Change and scope
CutterBridgeClientparses the authenticated response with a reviver. When a parsed number is not a safe integer and its source text (context.source) is an integer literal, the reviver returns that text. This follows the same source-text pattern asparseKunaJsonandreadPlistJson.CutterBridgeServiceadds one limitation tojson: trueevidence that says such integers are returned as decimal strings. Text-mode (json: false) evidence does not change.Not included: no change to the Python bridge, the frame decoder or the tool schema (
outputis alreadyjsonValueSchema). Non-integral numbers that round are left as they are, because Rizin does not emit them for addresses.Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Contract and boundary impact
CutterBridgeClientresponse parsing (after proof verification).CutterBridgeServiceevidence limitations consume it. No path was removed.json: trueoutput, an integer whose magnitude exceeds 2^53 - 1 is now a JSON string where it used to be a rounded number.normalized_result.outputandraw_resultkeep exact digits. A new limitation names the representation.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
tests/boundary/providers/CutterBridgeClient.test.ts"keeps exact digits of Rizin's unsigned 64-bit JSON addresses" serves the real Rizin 0.9.1afljintegers through the authenticated v2 frame fixture.tests/boundary/providers/CutterBridgeService.test.tsasserts that the limitation is present forjson: trueand absent forjson: false.54906fdb1fc735b507961b2954f6968775cae4f6. The producer bytes came from realrizin 0.9.1(Homebrew, darwin-arm64),rizin -N -q -e scr.color=0 -c 'aa;aflj', on an 8-byte x86-64 ELF64 loaded at0xffffffff81000000. Withsrc/reverted, the client test failed with"offset": 18446744071578845000,"minbound": 18446744071578845000and"maxbound": 18446744071578845000where the exact strings were expected. With the fix, it passed.cmdjbehavior is source-derived fromrizinorg/cuttersrc/python/cutter.py.Lifecycle regressions: not applicable, because this change does not touch ownership, cancellation or cleanup.
For evidence-bearing changes:
Validation performed
npx vitest run tests/boundary/providers/CutterBridgeClient.test.ts tests/boundary/providers/CutterBridgeService.test.ts: 60/60 passed with the fix. The new client test failed on base withsrc/reverted.npx vitest run tests/boundary/providers/cutterBridgeProducer.test.ts: one or two cases hitspawnSync python3 ETIMEDOUTunder machine load (load average about 79). The same case fails identically on base withsrc/reverted, so these failures are environmental.npm run check:fast(typecheck and lint): passed.npx oxfmt --checkon the changed files: passed.npm run test:focuseddid not reach Vitest on this machine.metadata:checkfails inscripts/lib/verifier-source-loader.mjsbecause Node 26.12.1 rejectsstripTypeScriptTypesmode: "transform". This fails before any test runs and is unrelated to this change.Compatibility, safety, and release
Prepared with AI assistance. Human ownership declarations remain pending.
Author readiness
Human owner: @rudycelekli
Before merge
type(scope): outcome.