From 00f557e02ebe8437fb65c547e7ec24bc9e73ee0d Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 22 Oct 2026 15:48:30 +0000 Subject: [PATCH] G8: regression test for art style filter cap ## Summary Illustrator `%AI9` art styles already stop reading filters after 4096 entries so hostile styles cannot grow without bound. This adds a regression test that importing a style with more than `MAX_FILTERS` basic filters finishes with a bounded effect list, matching the existing hardening behaviour. ## Tests - `art_styles_ignore_filters_beyond_the_cap` in `crates/eps/src/import/ai/style.rs` Part of gap G8 Co-authored-by: nrq6993-a11y --- crates/eps/src/import/ai/style.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/eps/src/import/ai/style.rs b/crates/eps/src/import/ai/style.rs index e915e5935..68739fb05 100644 --- a/crates/eps/src/import/ai/style.rs +++ b/crates/eps/src/import/ai/style.rs @@ -764,6 +764,19 @@ mod tests { assert_eq!(feather.params["radius"].as_f64(), Some(5.0)); } + #[test] + fn art_styles_ignore_filters_beyond_the_cap() { + const UNIT: &[u8] = b"/BasicFilter :\n(Adobe Feather) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n; /Dict ;\n /Part ,\n"; + let mut data = + Vec::from(b"/KnownStyle :\n(Capped) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n"); + for _ in 0..MAX_FILTERS + 16 { + data.extend_from_slice(UNIT); + } + data.extend_from_slice(b";\n"); + let style = art_styles(&data).remove("Capped").unwrap_or_default(); + assert!(style.effects.len() <= MAX_FILTERS); + } + #[test] fn hostile_dash_offsets_and_width_profiles_are_tamed() { let mut f = Filter::default();