perf(policy): bound wildcard matching on adversarial inputs (#9486)

Co-authored-by: Kuromi <kuromiqiyu@gmail.com>
Co-authored-by: GatewayJ <835269233@qq.com>
Co-authored-by: Hauser Zhi <housemecn@gmail.com>
Co-authored-by: Chris An <anzhengchao@gmail.com>
This commit is contained in:
祈雨
2026-11-28 13:27:28 +00:00
committed by GitHub
parent bbf422e1ee
commit bc990465e2
@@ -230,6 +230,12 @@ mod tests {
assert!(!is_simple_match("*🎉*🚀", "prefix🎉mid"));
}
#[test]
fn test_question_mark_matches_bytes_not_unicode_scalars() {
assert!(!is_match("prefix?", "prefix界"));
assert!(is_match("prefix???", "prefix界"));
}
/// Reference backtracking definition used only for small exhaustive equivalence checks.
fn backtracking_match(pattern: &[u8], name: &[u8], simple: bool) -> bool {
match pattern.split_first() {