[258] Bindungen: usize-Überlauf bei Zählern, Endlosschleifen in Schraffur/Dach-Skelett/Delaunay, Treppen-Speicherflut (je regression_*-Test)

This commit is contained in:
Claude committed 2026-11-14 11:09:36 +00:00
1 parent a8f59d677c
commit be38da9e97
10 files changed
+205 -42

No files matched your search

+3 -1
View File
@@ -303,7 +303,9 @@ fn split_steps(body: i64, run1: f64, run2: f64, run1_steps: Option<i64>) -> (i64
let s1 = match run1_steps {
Some(n) => n.min(body - 1).max(1),
None => {
let v = ((body as f64 * run1) / (run1 + run2)).round() as i64;
// `as i64` sättigt bei ∞ (Lauflänge f64::MAX: Summe/Produkt laufen über) → i64::MAX Stufen, Speicher-Abbruch
// ([258]); im Normalfall liegt v unter body, die Begrenzung ändert dort nichts.
let v = (((body as f64 * run1) / (run1 + run2)).round() as i64).min(body.max(1));
if v < 1 { 1 } else { v }
}
};
+12
View File
@@ -322,6 +322,18 @@ fn near(a: Vec2, x: f64, y: f64) -> bool {
(a.x - x).abs() < 1e-9 && (a.y - y).abs() < 1e-9
}
/// [258] Lauflänge f64::MAX (Summe/Produkt laufen über, Stufenzahl sättigt zu i64::MAX): endlich viele Tritte.
#[test]
fn regression_stair_riesige_lauflaenge() {
for shape in ["L", "U", "straightLanding", "straight"] {
let mut p = stair(shape);
p.run_length = f64::MAX;
p.run2_length = Some(3.0);
let g = stair_geometry(&p, 1.0);
assert!(g.treads.len() <= 20, "{shape}: {} Tritte", g.treads.len());
}
}
#[test]
fn stair_gerade_tritte_lauflinie_pfeil() {
let g = stair_geometry(&stair("straight"), 2.8);