fix(anatomy): V1-2.2 path numbers bounded by the frame magnitude

Fresh security review and verifier (MEDIUM): browsers read path data in
f32 and draw nothing for an arc radius or rotation past f32::MAX (WebKit
from 1e30) while the endpoints kept the verdict green. Every path and
viewBox number is now read within 2^20, else the path is unreadable.
Docs: section 12.12 transform table, mutation record, open zone finding.
This commit is contained in:
bchanot committed 2026-11-01 01:49:49 +01:00
1 parent 96b99784b5
commit 76ead9567c
4 files changed
+51 -6

No files matched your search

@@ -360,3 +360,24 @@ fn transforms_inside_the_drawing_never_change_the_measure() {
"{issues:?} {failures:?}"
);
}
/// Path numbers past `2²⁰` (security review 2026-11-01): browsers read them in `f32` and draw
/// nothing for an arc radius or a rotation past `f32::MAX` (WebKit from `1e30`), while the bounds
/// stay those of the endpoints. Refused as path data a browser would not read whole.
#[test]
fn path_numbers_past_the_frame_magnitude_are_refused() {
let main = |d: &str| codes(&on_main(path(d), "0 0 10 10"));
assert!(
main("M1 1A1048576 1048576 0 0 1 3 1L3 3L1 3Z").is_empty(),
"2^20: a straight side"
);
for d in [
"M1 1A1048577 1048577 0 0 1 3 1L3 3L1 3Z",
"M1 1A1e30 1e30 0 0 1 3 1L3 3L1 3Z",
"M1 1A1e39 1e39 0 0 1 3 1L3 3L1 3Z",
"M1 1A1 1 1e39 0 1 3 1L3 3L1 3Z",
"M1 1L3 1L3 3L-1e39 3Z",
] {
assert_eq!(main(d), [OUT_OF_FRAME], "{d}");
}
}