From c9e93bd88a2c142e8d900bd0c0f6a32346241e5e Mon Sep 17 00:00:00 2001 From: Adolanium <94890352+Adolanium@users.noreply.github.com> Date: Sat, 24 Oct 2026 11:51:06 +0300 Subject: [PATCH] test(apple): budget Rosetta registers before reading them --- src/native/apple/AppleIpsParser.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/native/apple/AppleIpsParser.test.ts b/src/native/apple/AppleIpsParser.test.ts index 6a8b12dbaa..eff164c92e 100644 --- a/src/native/apple/AppleIpsParser.test.ts +++ b/src/native/apple/AppleIpsParser.test.ts @@ -668,6 +668,21 @@ it("budgets register slots before expanding threadState rows", () => { ); }); +it("budgets Rosetta registers with the ordinary registers they follow", () => { + const rosetta = (third: string): Buffer => + withBody( + `{"threads":[{"threadState":{"x":[0],"rosetta":{"tmp0":0,"tmp1":0,"tmp2":${third}}}}],"usedImages":[]}`, + ); + expect(parse(rosetta("0"), { max_registers: 4 }).coverage).toMatchObject({ + status: "complete", + registers: 4, + }); + // The register past the allowance is invalid JSON; the budget must refuse first. + expect(() => parse(rosetta("?"), { max_registers: 3 })).toThrow( + expect.objectContaining({ boundary: "registers", maximum: 3 }), + ); +}); + it("refuses an over-budget collection before parsing the rows past the allowance", () => { // Rows after the allowance are invalid JSON; the budget must refuse first. const threads = withBody(`{"threads":[{},{},{},?],"usedImages":[]}`);