Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix font feature tag validation (#13542)
张小白18b457306431
diff --git a/crates/gpui/src/text_system/font_features.rs b/crates/gpui/src/text_system/font_features.rsindex ef6d76481ad..db48db62ef2 100644--- a/crates/gpui/src/text_system/font_features.rs+++ b/crates/gpui/src/text_system/font_features.rs@@ -58,7 +58,7 @@ impl<'de> serde::Deserialize<'de> for FontFeatures {while let Some((key, value)) =access.next_entry::<String, Option<FeatureValue>>()?{- if key.len() != 4 && !key.is_ascii() {+ if !is_valid_feature_tag(&key) {log::error!("Incorrect font feature tag: {}", key);continue;}@@ -142,3 +142,15 @@ impl schemars::JsonSchema for FontFeatures {schema.into()}}++fn is_valid_feature_tag(tag: &str) -> bool {+ if tag.len() != 4 {+ return false;+ }+ for ch in tag.chars() {+ if !ch.is_ascii_alphanumeric() {+ return false;+ }+ }+ true+}