fix(anatomy): V1-2.2 refuse arc radii browsers read as zero

Security review of the interior rule: an arc radius below f32
precision was scaled by the core to a half disc the browser never
fills. Nonzero radii below 2^-20 make the path unreadable; arcs add
their f32 drift to the chord deviation; tracing stops past the vertex
cap; a path without outline is refused.
This commit is contained in:
bchanot committed 2026-11-01 12:40:14 +01:00
1 parent 8dd2d78d38
commit 03be75beed
6 files changed
+126 -29

No files matched your search

+22 -8
View File
@@ -4341,7 +4341,8 @@ rule is a scale floor against the bypass, never a review of shapes (the zones ke
security review measured its consequence (MEDIUM, open, owner decision): a zone path whose interior has zero winding
(an outline traced twice in opposite directions) or a near-collinear polygon passes the 4 px rule, paints no interior
and is hit only on its 2-unit stroke (0.28 CSS px on the equine phone scale), in the three engines. Closing it needs a
filled-area measure (nonzero rule) or a « zone without interior » issue.
filled-area measure (nonzero rule) or a « zone without interior » issue. Closed by the interior rule (owner brief of
2026-11-01, §12.14).
### 12.14 The last MEDIUM: zone without interior (owner, 2026-11-01)
@@ -4381,12 +4382,12 @@ validated equine; below, a tap target smaller than the points'.
| `path` unit tests | 300 random cubics, quadratics and arcs: every curve point within the recorded deviation of its chords, the deviation within 0.05 unless capped (arcs whose radii the endpoints scale up); closepath restarts at the subpath start; vertex cap |
Browsers (`apps/app/e2e/ui/interior-clicks.spec.ts`, the six click projects: Chromium 1280, 375 and 320 touch, Firefox
1280, WebKit 1280 and 375 touch; 90 passed, and `canvas-clicks.spec.ts` 99 unchanged). The probe
(`e2e/fixtures/interior-probe.json`, written and drift-checked by `tests/interior_probe.rs`) gives 14 shapes in the
1280, WebKit 1280 and 375 touch; 96 passed, and `canvas-clicks.spec.ts` 99 unchanged). The probe
(`e2e/fixtures/interior-probe.json`, written and drift-checked by `tests/interior_probe.rs`) gives 15 shapes in the
preview's 286 × 310 box (one unit per CSS px) with the core's verdict and widest disc. For each, the browser's own fill
(`pointer-events="fill"`, stroke out) is sampled every 0.25 px and its widest disc taken by an exact distance transform:
the core never claims more than the browser fills (at most 0.5 px under it); the 8 refused fill no 4 px disc in any
engine; the 6 accepted take a real click or tap at the core's centre and the hit test at 32 points of 90 % of its radius,
the core never claims more than the browser fills (at most 0.5 px under it); the 9 refused fill no 4 px disc in any
engine (the ninth, an arc radius of `1e-49`, fills nothing at all); the 6 accepted take a real click or tap at the core's centre and the hit test at 32 points of 90 % of its radius,
fill only and as shipped. A drawing root `fill-rule="evenodd"` leaves the pentagram filled at its centre (isolation).
Then the equine shapes in the canvas: the core's disc hit test-clear (samples under a point's disc aside, at most a
quarter), and a real press where the fill lies farthest from every disc records the zone.
@@ -4403,9 +4404,22 @@ interior of a zone, takes its taps; no rule refuses it. The human review identif
is published; no proof here claims that every marker is individually selectable when two overlap entirely. The arc
rotation reduced in `f32` by browsers (sub-pixel, §12.13) stays bounded by the `2²⁰` number bound, its tests kept.
Mutations (`.claude/audits/2026-11-01-v1-2-2-mutations-interior.py`): 24 killed, Z22 (the floor prune removed) survives
as equivalent, a cell that cannot reach the floor never holding an accepted disc; S1, S8 and F16 of the previous scripts,
whose anchors moved, re-anchored and killed. Module 579 180 B gzip -9 (+4 946 B, budget 600 000, margin 20 820 B).
Fresh reviews on `8dd2d78`. Security PASS with one MEDIUM, fixed: an arc radius below `f32` precision (`1e-49`) was read by
the core as the half disc its endpoints scale it to, while browsers read it as zero (a straight line) or, below about
`1e-19`, square it to nothing; the core accepted a shape the browser never fills. An arc radius other than zero is now at
least `path::MIN_ARC_RADIUS` `2⁻²⁰` (the scaled radii stay finite in `f32`), else the path is unreadable
(`out_of_frame`): `a_tiny_arc_radius_is_not_read`, `path_numbers_past_the_frame_magnitude_are_refused`, probe
`arc-radius-1e-49`. Its LOWs, fixed: an arc adds its scaled radius × `2⁻²³` to the deviation (the browser's `f32` arc
arithmetic, a bound, not a measure: `a_large_arc_radius_adds_its_f32_drift`); the flattening stops tracing once over the
vertex cap; a path without an outline is refused, not accepted (unreachable, the bounds and the outline sharing one
reader). Informational: verdict and preview may differ by a libm ulp between native and wasm on a shape tuned to the
threshold; the verdict has no production caller yet (V1-2.3). Verifier ECARTS(3), all documentation: this section's
pointer from §12.13, the × 1.235 assertion, the audit tools committed.
Mutations (`.claude/audits/2026-11-01-v1-2-2-mutations-interior.py`): 26 killed, 2 equivalent: Z22 (the floor prune
removed; a cell that cannot reach the floor never holds an accepted disc) and Z25 (a path without an outline accepted;
unreachable). S1, S8 and F16 of the previous scripts, whose anchors moved, re-anchored and killed. Module 579 357 B gzip -9
(native build; +5 124 B, budget 600 000, margin 20 643 B).
Ignored cargo tests: the three are one test, `pdf_serialize::l_report_with_real_rasters_costs_what_it_costs`, counted
once per cargo run whose features build `pdf_serialize` (workspace, `cli`, `ts,pdf-read,pdf-write`). A timing print for