diff --git a/crates/solidcore/src/surface/surface/p1.rs b/crates/solidcore/src/surface/surface/p1.rs index 0c95c953fd..9e09eedc43 100644 --- a/crates/solidcore/src/surface/surface/p1.rs +++ b/crates/solidcore/src/surface/surface/p1.rs @@ -1131,6 +1131,7 @@ impl Surface { highest_v_deriv: usize, flags: EvaluateFlags, ) -> Result>> { + self.check_evaluation_copy_depth(0)?; match self.kind() { SurfaceKind::BSpline(s) => s.evaluate_simple( uv, diff --git a/crates/solidcore/src/surface/surface/p2.rs b/crates/solidcore/src/surface/surface/p2.rs index a9b25b0fd7..1fe4fe5784 100644 --- a/crates/solidcore/src/surface/surface/p2.rs +++ b/crates/solidcore/src/surface/surface/p2.rs @@ -4979,6 +4979,25 @@ mod kernel_dispatch_tests { EvaluateFlags::default() ) .is_err()); + let mut bounded = surface.clone(); + for _ in 0..70 { + bounded = Surface::from(CurveBoundedSurface::new( + bounded, + Vec::new(), + Vec::new(), + true, + )); + } + assert!(matches!( + bounded.evaluate_simple( + &kernel, + Point2::new(0.5, 0.5), + 0, + 0, + EvaluateFlags::default(), + ), + Err(SolidError::InvalidInput { .. }) + )); for _ in 0..70 { surface = Surface::from(StepSurface::new(surface, true)); } diff --git a/plan/findings.md b/plan/findings.md index 31c3fc7122..12b0ac127a 100644 --- a/plan/findings.md +++ b/plan/findings.md @@ -5446,3 +5446,8 @@ Apple build after their removal. The final GNU rerun is recorded below when complete. No #71/#100 numerical implementation is imported. Common intersection adapter errors now identify the remaining Surface integration rather than the already-partial cone numerical unit. + +The review also found `Surface::evaluate_simple` recursively delegates through +curve-bounded bases without the preflight used by the other common evaluators. +It now checks the same 64-level owned-geometry limit before dispatch; a 70-level +curve-bounded regression verifies normal `InvalidInput` rather than recursion.