chore(memory): BDR-058 R4.2 validated and R4.3 gates; LRN-061, LRN-062; R4.3 subtasks

This commit is contained in:
bchanot committed 2026-10-18 17:41:12 +02:00
1 parent 6deee65b79
commit f41dd59b2c
4 files changed
+26 -1

No files matched your search

+12
View File
@@ -466,3 +466,15 @@ Apply: Rust ports of JS readers of untrusted text (R4 PDF reader, Step 13 upload
- `--target web` glue keeps the instance in module scope (`let wasm`, `__wbg_finalize_init`); ES module records are never unloaded, so each fresh glue import (`?instance=n`) keeps its old instance and memory (BLK-012: dead instances retained until reload). Linear memory never shrinks.
- Memory-heavy one-shot work: reuse the long-lived instance (high-water kept until reload) or run in a Worker terminated after (everything freed). A "disposable instance" on the main thread is a leak, not a release.
Apply: R4 import worker and export placement, any future in-browser wasm batch job.
## LRN-061 | 2026-10-18 | A multi-budget pre-scan must keep every budget sound, even once another check already refuses
- R4.2 `json_js::prescan` returned early at depth > 64 with the partial value count; the PDF probe checked both verdicts, the rescue copy checked values only → a 16 MiB copy nested 65 deep reported 66 values, passed the budget, built 792 MiB (security gate BLOCK, fixed 593893a: count runs to the end, depth verdict kept).
- Rule: one linear pass serving several guards finishes every measure; an early return for one verdict silently disarms the callers that rely on the others. Controls must never neutralise each other; a refusal path stays bounded in time and memory.
Apply: any shared pre-scan / lexer feeding several caps (R4.3 worker, R5 pipeline, Step 13 uploads); test each guard alone with the other verdict already failing.
## LRN-062 | 2026-10-18 | Non-finite numbers: follow the JSON actually serialised, not the JS type before serialisation
- `parseVersioned` tested `typeof version === 'number'` on `JSON.parse` output: `1e999` → `Infinity`, a number, so the probe accepted; `JSON.stringify` then wrote `null`, so the core saw no version → `no_attachment`. A Rust port that rewrote overflow → `null` before the probe gave `attachment_stripped` (3 O8 rows).
- Fix: probe on a copy where overflowing tokens stay finite numbers (`rewrite_overflow_numbers_as_finite`, `0`), hand the `null` form to the core. Same family as LRN-059 (overflow, lone surrogates): every JS parse → stringify hop is a transformation to reproduce step by step, in order.
Apply: porting any JS reader whose acceptance test ran between parse and stringify (R4 writer inputs, R5 pipeline, server validation).