.ai save: check a frame's segment count before building its path

A frame or path past the segments the reader reads is rejected from its count, before it is copied and converted.
This commit is contained in:
dotCooCoo
2026-11-07 05:15:17 +07:00
committed by bflatastic
parent 9006177033
commit 7be6f8731c
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -3487,7 +3487,7 @@ fn an_open_frame_whose_ends_meet_is_written_as_its_outlines() {
let open = |r: Rect| {
let mut frame = shapes::rectangle(r);
frame.subpaths[0].closed = false;
let start = frame.subpaths[0].anchors[0].clone();
let start = frame.subpaths[0].anchors[0];
frame.subpaths[0].anchors.push(start);
frame
};
+1 -1
View File
@@ -445,7 +445,7 @@ fn strong_direction(c: char) -> Option<bool> {
/// document is one path), of no more segments than the reader reads.
fn segments(path: &PathData) -> Option<Vec<[f64; 8]>> {
let mut drawn = path.subpaths.iter().filter(|sp| !sp.anchors.is_empty());
let sp = drawn.next().filter(|sp| sp.anchors.len() > 1)?;
let sp = drawn.next().filter(|sp| sp.anchors.len() > 1 && sp.segment_count() <= crate::import::MAX_SEGMENTS)?;
if drawn.next().is_some() {
return None;
}