fix(anatomy): V1-2.2 frame slack on the span only, non-finite bounds refused

Security review: the edge slack grew with the frame's offset (a frame at
1e15 accepted a circle 4000 units past its edge) and f64 min/max drop a
NaN bound. The slack now follows the span only; a non-finite bound is
unreadable, never in frame.
This commit is contained in:
bchanot committed 2026-10-31 23:36:18 +01:00
1 parent 587cbb2b5d
commit 9e49ed1b4d
2 files changed
+26 -4

No files matched your search

+15
View File
@@ -407,3 +407,18 @@ fn both_composers_frame_the_view_on_the_measured_frame() {
assert_eq!(composed.attr("preserveAspectRatio"), None);
}
}
/// The edge slack follows the frame's span, never its offset: a frame far from the origin
/// keeps the same strictness (security review of the three-MEDIUM brief).
#[test]
fn a_frame_far_from_the_origin_is_as_strict() {
let far = |cx: f64| {
with_view_box(
&with_geometry("main", circle(cx, 5.0, 1.0)),
0,
json!({ "min_x": 1e15, "min_y": 0, "width": 1000, "height": 10 }),
)
};
assert!(accepted(&far(1e15 + 500.0)));
assert!(!accepted(&far(1e15 + 5000.0)));
}