mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 21:46:01 +00:00
* fix(apple): observe keyed-archive dates when the offset table reaches the trailer inspect_keyed_archive preflights binary plists with decoder bounds, which admit an offset table that ends anywhere before end of file, including inside the 32-byte trailer. plist@5 reads such a table. Dates must still end before the offset table, so the preflight records each reachable date. The scalar scanner, however, required the table to end before the trailer. For a table that runs into the trailer it abandoned the whole file and collected no dates. The precision clamp in decodeBinaryPlistScalars then saw no unrepresentable date, so a 0.1005 s instant was reported as the exact timestamp 2001-01-01T00:00:00.100Z with no unknown-date limitation. Bound the scanner's offset-table reads by the end of the file, which is the widest table any preflight admits. Strict preflight already rejects tables past the trailer before scanning, so strict callers are unchanged. Object and date bounds still end at the offset table. * fix(apple): rebuild a complete trailer when cloning plist scalars Review follow-up. With the scanner observing dates when the offset table runs into the trailer, a sub-millisecond date that overlaps another object now reaches cloneBinaryPlistObjects. That rewrite sized its output as bytes.length plus the growth of a table assumed to end before the trailer. When the old table overlaps the trailer, those bytes exist only once, so the buffer came out short and the copied trailer was truncated. plist@5 then failed with "Unsupported int size: 0". binaryPlistCloneGrowth now computes the bytes a clone rewrite adds, subtracting only the old table bytes that precede the trailer. The allocator and both preflight budget estimates use it, so admission and allocation agree. For tables that end before the trailer the value is unchanged. * fix(apple): keep every source byte when cloning plist scalars Review follow-up (Codex). Decoder bounds admit an offset table that runs into the trailer and an object stored in the trailer's spare bytes after it. With dates now observed for that layout, an overlapping sub-millisecond date reaches cloneBinaryPlistObjects. Since #7820 the rewrite appends clones and a fresh table, but only after the bytes before the trailer, so it overwrote such an object and plist@5 failed with "Unsupported int size: 256". Copy the whole source buffer and append the clones, the new table and a new trailer after it. The old table and trailer stay as inert bytes, so every source offset still names its original record. The offset width and both preflight estimates now account for the clones starting at the end of the buffer and for the extra trailer. * test(apple): match main's limitation assertions in keyed-archive date tests * fix(apple): observe binary plist dates only when they end before the trailer --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>