mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-07 12:13:19 +00:00
.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:
@@ -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
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user