From 77505bb7152aa314af8dab028757dd6aa1901f15 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 12:02:58 -0800 Subject: [PATCH] craft-svg: a bracket in an element declaration does not end the subset XML readers skip an element, attribute list or notation declaration to its first `>`, quotes and brackets included. The guard's scans now end these declarations the same way. A `]` inside `` no longer ends the internal subset for `too_wide` and `prescan`, and a `[` in one no longer lets a later `"), _ if rest.starts_with(b" past(b, i + 2, b"?>"), _ => i + 1, @@ -552,6 +563,7 @@ mod tests { format!("{large}]>"), format!(""), format!("{large}]>"), + format!("{large}]>"), ] { assert!(expansion_too_large(&format!("{hidden}"))); } @@ -564,7 +576,7 @@ mod tests { fn markers_in_a_literal_hide_no_markup_from_the_depth_or_attribute_counts() { let tenth = DEPTH / 10 + 1; let nested = format!("{}{}", "".repeat(tenth), "".repeat(tenth)); - for bait in ["", "", "\">"] { + for bait in ["", "", "\">", ""] { assert!(too_deep(&format!("]>&a;")), "{bait}"); } // Comments and instructions in a value open and close no element. @@ -577,6 +589,8 @@ mod tests { assert!(!too_deep(&format!("{}", svg(&groups(8))))); let many = (0..5000).map(|i| format!(" a{i}=\"1\"")).collect::(); assert!(wide(&format!("\">'>]>&e;"))); + // An element declaration ends at its first `>`, so a `]` inside it does not end the subset. + assert!(wide(&format!("'>]>&e;"))); } #[test]