[PR #4422] [CLOSED] fix(artifacts): preserve binary keyed archive integers above Int64.max #6233

Closed
opened 2026-10-31 01:12:53 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4422
Author: @dav9fulldev
Created: 10/16/2026
Status: ❌ Closed

Base: main ← Head: fix/binary-plist-16byte-integers


📝 Commits (9)

  • 890f640 fix(artifacts): preserve binary keyed archive integers above Int64.max
  • f081c0d fix(domain): decode three-byte and non-power-of-two UIDs in binary plists
  • 765dd0a perf(domain): decode binary plist strings via TextDecoder
  • 4db9bf6 fix(domain): preserve leading U+FEFF in binary plist UTF-16 strings
  • c445022 Merge branch 'main' into fix/binary-plist-16byte-integers
  • 4d88389 fix(apple): remove duplicate binary decoder calls and retain wide integer tracking
  • 8a78d71 Merge remote-tracking branch 'upstream/main' into fix/binary-plist-16byte-integers
  • c4e149e fix(domain): preserve oversized UIDs and disclose numeric ambiguity
  • 9e7b0db Merge remote-tracking branch 'upstream/main' into fix/binary-plist-16byte-integers

📊 Changes

4 files changed (+275 additions, -8 deletions)

View changed files

📝 src/artifacts/apple/KeyedArchiveReader.test.ts (+71 -0)
📝 src/artifacts/apple/KeyedArchiveReader.ts (+3 -8)
📝 src/domain/propertyListKeys.test.ts (+37 -0)
📝 src/domain/propertyListKeys.ts (+164 -0)

📄 Description

Summary

Fixes #4292. Preserves exact integer values stored as 16-byte integers (marker 0x14) in binary property list (bplist00) keyed archives, such as unsigned 64-bit integers exceeding Int64.max (e.g. UInt64.max = 18446744073709551615).

Previously, binary keyed archives with integers above Int64.max caused two silent failures:

  1. The pinned plist 5.0.0 parser only read the high 8 bytes of 16-byte integers (marker & 0x0f === 4), fabricating 0 as an observed integer value for values < 2^{64}.
  2. PlistNumberLiterals.binaryPlistNumberLiterals flagged any binary integer wider than 8 bytes (width > 4) as incomplete: true, which prevented exact decimal text projection for all large integers throughout the entire archive.

This change introduces parseBinaryPropertyList in src/domain/propertyListKeys.ts to decode binary property lists with full 16-byte integer and prototype-key safety, updates binaryPlistNumberLiterals to extract 16-byte integers with exact 128-bit BigInt precision, and routes binary keyed archive decoding through parseBinaryPropertyList.

Problem and expected behavior

When a binary keyed archive contains an integer exceeding Int64.max (such as UInt64.max = 18446744073709551615 stored with marker 0x14):

  • Observed failure on REA 6.5.0:
    • The object was reported with value: 0 (status: "observed").
    • Number metadata was flagged as incomplete: true.
    • Coexisting 64-bit integers (e.g. Int64.max = 9223372036854775807) lost their exact decimal representation and were projected as rounded IEEE 754 floats (9223372036854776000).
    • Limitations warned: "Original archive number metadata could not be completely observed; raw numbers and exact decimal values may be incomplete or unavailable."
  • Expected behavior:
    • UInt64.max is projected with exact decimal text: {"$plist_type": "integer", "decimal": "18446744073709551615"}.
    • Int64.max retains exact decimal text: {"$plist_type": "integer", "decimal": "9223372036854775807"}.
    • Limitations report: 2 unambiguous integer value(s) are reported with exact decimal text as { "$plist_type": "integer", "decimal": "<exact digits>" }. without the incomplete metadata warning.

Change and scope

  • Added parseBinaryPropertyList to src/domain/propertyListKeys.ts with support for all standard binary property list data types, 16-byte integers (hi << 64n | lo), and __proto__ key omission protection.
  • Updated binaryPlistNumberLiterals in src/artifacts/apple/PlistNumberLiterals.ts to extract 16-byte integer literals as exact strings via DataView.getBigInt64 and DataView.getBigUint64.
  • Routed decodeKeyedArchiveBytes in src/artifacts/apple/KeyedArchiveReader.ts to use parseBinaryPropertyList instead of plist.parseBinary.
  • Added unit regression test verifying 16-byte and 8-byte integer projection in src/artifacts/apple/KeyedArchiveReader.test.ts.

Follow the contribution scope.
Ordinary fix within existing boundaries; maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: KeyedArchiveReader.ts / PlistNumberLiterals.ts during artifact archive decoding.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: Apple binary property list (bplist00) keyed archives across all supported platforms.
  • Evidence, artifact, provenance, or reconstruction contract: preserves exact integer decimal representations for values up to 128-bit integers without losing exact projection for coexisting integers.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): none.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated:
    • src/artifacts/apple/KeyedArchiveReader.test.ts: test "reports integers above Int64.max stored as 16-byte integers with exact decimal text (issue #4292)".
  • Base reproduction or other evidence:
    • Binary plist buffer containing 0x140000000000000000ffffffffffffffff (UInt64.max) and 0x137fffffffffffffff (Int64.max).
    • On upstream/main before fix: value: 0 for UInt64.max, incomplete: true in metadata, Int64.max rounded to 9223372036854776000.
    • With fix: both values accurately reported with exact decimal text and complete metadata.
  • User-visible CLI/MCP output:
    {
      "id": 1,
      "status": "observed",
      "value": {
        "$plist_type": "integer",
        "decimal": "18446744073709551615"
      }
    }
    
    

Remaining proof gaps: none.
For evidence-bearing changes:

Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
npx vitest run src/artifacts/apple/KeyedArchiveReader.test.ts — passed (21/21 tests, including regression test for #4292).
npx vitest run tests/acceptance/applications/interfaceBuilderPlistNumbers.test.ts — passed (6/6 tests).
npm run check:fast — passed (turbo typecheck & lint 0 errors).
npm run format:check / npx oxfmt — formatted and verified clean.
git diff & git status — reviewed and verified cleanly isolated to bugfix scope.
Compatibility, safety, and release
Breaking changes or migration steps: none.
Real Hopper/Ghidra, browser, or OS coverage: macOS binary property list decoding tested in Node.js runtime.
Package or release metadata impact: none.
Security, privacy, process, or containment review: preserves existing prototype poisoning mitigations (PROTOTYPE_KEY filtering) and memory limits.
Author readiness
Human owner: @dav9fulldev

I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
I declare this PR ready for initial maintainer review.
Before merge
This PR addresses a concrete problem or an agreed enhancement.
Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
The PR has one focused outcome and the title follows type(scope): outcome.
Related issue is linked, or the reason for not linking one is stated above.
Tests cover changed observable behavior and meaningful failure paths.
Owning docs, contracts, and generated metadata are updated where needed.
User-visible CLI/MCP changes include representative output.
I checked the final diff for secrets, unrelated cleanup, and unsupported claims.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4422 **Author:** [@dav9fulldev](https://github.com/dav9fulldev) **Created:** 10/16/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/binary-plist-16byte-integers` --- ### 📝 Commits (9) - [`890f640`](https://github.com/morluto/rea/commit/890f6400cb472484ceace614cdad04d09d53b632) fix(artifacts): preserve binary keyed archive integers above Int64.max - [`f081c0d`](https://github.com/morluto/rea/commit/f081c0df3700a7ff6c6c4565ba9607dda010d821) fix(domain): decode three-byte and non-power-of-two UIDs in binary plists - [`765dd0a`](https://github.com/morluto/rea/commit/765dd0a61bbf099df355404cb139d9dda604894a) perf(domain): decode binary plist strings via TextDecoder - [`4db9bf6`](https://github.com/morluto/rea/commit/4db9bf6a65fd1bb46b7bfa74692a44a6f7e69cd5) fix(domain): preserve leading U+FEFF in binary plist UTF-16 strings - [`c445022`](https://github.com/morluto/rea/commit/c445022a965e820697b3cb95e379177106767f8c) Merge branch 'main' into fix/binary-plist-16byte-integers - [`4d88389`](https://github.com/morluto/rea/commit/4d88389aeeeeb7c658065fc126cc8648737f1a00) fix(apple): remove duplicate binary decoder calls and retain wide integer tracking - [`8a78d71`](https://github.com/morluto/rea/commit/8a78d71c58220af3ce09490d54647144b679e911) Merge remote-tracking branch 'upstream/main' into fix/binary-plist-16byte-integers - [`c4e149e`](https://github.com/morluto/rea/commit/c4e149e19a3cf26bfeac3402f1495abb4a8e3daf) fix(domain): preserve oversized UIDs and disclose numeric ambiguity - [`9e7b0db`](https://github.com/morluto/rea/commit/9e7b0db389fa9444797a4f8610f29d8bedf16fde) Merge remote-tracking branch 'upstream/main' into fix/binary-plist-16byte-integers ### 📊 Changes **4 files changed** (+275 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/apple/KeyedArchiveReader.test.ts` (+71 -0) 📝 `src/artifacts/apple/KeyedArchiveReader.ts` (+3 -8) 📝 `src/domain/propertyListKeys.test.ts` (+37 -0) 📝 `src/domain/propertyListKeys.ts` (+164 -0) </details> ### 📄 Description ## Summary Fixes #4292. Preserves exact integer values stored as 16-byte integers (marker `0x14`) in binary property list (`bplist00`) keyed archives, such as unsigned 64-bit integers exceeding `Int64.max` (e.g. `UInt64.max = 18446744073709551615`). Previously, binary keyed archives with integers above `Int64.max` caused two silent failures: 1. The pinned `plist` 5.0.0 parser only read the high 8 bytes of 16-byte integers (`marker & 0x0f === 4`), fabricating `0` as an observed integer value for values $< 2^{64}$. 2. `PlistNumberLiterals.binaryPlistNumberLiterals` flagged any binary integer wider than 8 bytes (`width > 4`) as `incomplete: true`, which prevented exact decimal text projection for all large integers throughout the entire archive. This change introduces `parseBinaryPropertyList` in `src/domain/propertyListKeys.ts` to decode binary property lists with full 16-byte integer and prototype-key safety, updates `binaryPlistNumberLiterals` to extract 16-byte integers with exact 128-bit `BigInt` precision, and routes binary keyed archive decoding through `parseBinaryPropertyList`. ## Problem and expected behavior When a binary keyed archive contains an integer exceeding `Int64.max` (such as `UInt64.max = 18446744073709551615` stored with marker `0x14`): - **Observed failure on REA 6.5.0:** - The object was reported with `value: 0` (`status: "observed"`). - Number metadata was flagged as `incomplete: true`. - Coexisting 64-bit integers (e.g. `Int64.max = 9223372036854775807`) lost their exact decimal representation and were projected as rounded IEEE 754 floats (`9223372036854776000`). - Limitations warned: *"Original archive number metadata could not be completely observed; raw numbers and exact decimal values may be incomplete or unavailable."* - **Expected behavior:** - `UInt64.max` is projected with exact decimal text: `{"$plist_type": "integer", "decimal": "18446744073709551615"}`. - `Int64.max` retains exact decimal text: `{"$plist_type": "integer", "decimal": "9223372036854775807"}`. - Limitations report: `2 unambiguous integer value(s) are reported with exact decimal text as { "$plist_type": "integer", "decimal": "<exact digits>" }.` without the incomplete metadata warning. ## Change and scope - Added `parseBinaryPropertyList` to `src/domain/propertyListKeys.ts` with support for all standard binary property list data types, 16-byte integers (`hi << 64n | lo`), and `__proto__` key omission protection. - Updated `binaryPlistNumberLiterals` in `src/artifacts/apple/PlistNumberLiterals.ts` to extract 16-byte integer literals as exact strings via `DataView.getBigInt64` and `DataView.getBigUint64`. - Routed `decodeKeyedArchiveBytes` in `src/artifacts/apple/KeyedArchiveReader.ts` to use `parseBinaryPropertyList` instead of `plist.parseBinary`. - Added unit regression test verifying 16-byte and 8-byte integer projection in `src/artifacts/apple/KeyedArchiveReader.test.ts`. Follow the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope). Ordinary fix within existing boundaries; maintainer scope decision is not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: `KeyedArchiveReader.ts` / `PlistNumberLiterals.ts` during artifact archive decoding. - Contribution scope fit and linked maintainer decision: not applicable. - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: Apple binary property list (`bplist00`) keyed archives across all supported platforms. - Evidence, artifact, provenance, or reconstruction contract: preserves exact integer decimal representations for values up to 128-bit integers without losing exact projection for coexisting integers. - Target selection, authority, upstream behavior, and cleanup details (if applicable): none. - Generated metadata, package, or installation impact: none. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: - `src/artifacts/apple/KeyedArchiveReader.test.ts`: test `"reports integers above Int64.max stored as 16-byte integers with exact decimal text (issue #4292)"`. - Base reproduction or other evidence: - Binary plist buffer containing `0x140000000000000000ffffffffffffffff` (`UInt64.max`) and `0x137fffffffffffffff` (`Int64.max`). - On `upstream/main` before fix: `value: 0` for `UInt64.max`, `incomplete: true` in metadata, `Int64.max` rounded to `9223372036854776000`. - With fix: both values accurately reported with exact decimal text and complete metadata. - User-visible CLI/MCP output: ```json { "id": 1, "status": "observed", "value": { "$plist_type": "integer", "decimal": "18446744073709551615" } } Remaining proof gaps: none. For evidence-bearing changes: Observed, derived, and inferred claims remain distinguishable. Artifact identity, source provenance, and failed attempts remain preserved. Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. Validation performed npx vitest run src/artifacts/apple/KeyedArchiveReader.test.ts — passed (21/21 tests, including regression test for #4292). npx vitest run tests/acceptance/applications/interfaceBuilderPlistNumbers.test.ts — passed (6/6 tests). npm run check:fast — passed (turbo typecheck & lint 0 errors). npm run format:check / npx oxfmt — formatted and verified clean. git diff & git status — reviewed and verified cleanly isolated to bugfix scope. Compatibility, safety, and release Breaking changes or migration steps: none. Real Hopper/Ghidra, browser, or OS coverage: macOS binary property list decoding tested in Node.js runtime. Package or release metadata impact: none. Security, privacy, process, or containment review: preserves existing prototype poisoning mitigations (PROTOTYPE_KEY filtering) and memory limits. Author readiness Human owner: @dav9fulldev I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. I declare this PR ready for initial maintainer review. Before merge This PR addresses a concrete problem or an agreed enhancement. Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. The PR has one focused outcome and the title follows type(scope): outcome. Related issue is linked, or the reason for not linking one is stated above. Tests cover changed observable behavior and meaningful failure paths. Owning docs, contracts, and generated metadata are updated where needed. User-visible CLI/MCP changes include representative output. I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:12:53 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6233
No description provided.