forked from 1b-agent/opencadstudio-upstream
Bound typed counts and values that could crash the editor
- ARRAYRECT, ARRAYPOLAR, ARRAYPATH, ARRAY3D and COPY Array reject item counts above 100,000 (checked as a product of every dimension) and keep the prompt open. Unbounded counts allocated one transform per item and aborted on allocation failure. Stored defaults are clamped as well. - EXPLODE leaves a MINSERT above the same limit intact instead of materializing every cell. - Typed lengths and angles reject non-finite values and magnitudes above 1e15; SCALE rejects a non-finite factor. - Zero-radius FILLET compares candidate intersections with total_cmp and rejects non-finite results; partial_cmp().unwrap() panicked on NaN. - SOLID falls back to a minimal kernel tolerance when its corners' extent overflows, since Tolerance::new panics on infinity. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
38aa2ee34d
commit
a3d65e2fc8
7 files changed
+223
-15
No files matched your search
@@ -179,12 +179,12 @@ impl CadCommand for ScaleCommand {
|
||||
return Some(CmdResult::NeedPoint);
|
||||
}
|
||||
let factor: f64 = t.replace(',', ".").parse().ok()?;
|
||||
(factor > 0.0).then(|| self.commit(base, factor))
|
||||
(factor.is_finite() && factor > 0.0).then(|| self.commit(base, factor))
|
||||
}
|
||||
Step::RefFirst { base } => {
|
||||
let base = *base;
|
||||
let ref_dist: f64 = t.replace(',', ".").parse().ok()?;
|
||||
if ref_dist > 0.0 {
|
||||
if ref_dist.is_finite() && ref_dist > 0.0 {
|
||||
self.step = Step::RefNew { base, ref_dist };
|
||||
return Some(CmdResult::NeedPoint);
|
||||
}
|
||||
@@ -194,7 +194,8 @@ impl CadCommand for ScaleCommand {
|
||||
Step::RefNew { base, ref_dist } => {
|
||||
let (base, ref_dist) = (*base, *ref_dist);
|
||||
let new_len: f64 = t.replace(',', ".").parse().ok()?;
|
||||
(new_len > 0.0).then(|| self.commit(base, new_len / ref_dist))
|
||||
let factor = new_len / ref_dist;
|
||||
(factor.is_finite() && factor > 0.0).then(|| self.commit(base, factor))
|
||||
}
|
||||
Step::Base => None,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user