-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
style: Fix starts_with_ignore_ascii_case. #17640
Conversation
In particular, fix a panic when the input is not ASCII and we happen to index in something that is not a char boundary. This fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1379380
Heads up! This PR modifies the following files:
|
components/style/str.rs
Outdated
@@ -149,5 +149,5 @@ pub fn str_join<I, T>(strs: I, join: &str) -> String | |||
/// Returns true if a given string has a given prefix with case-insensitive match. | |||
pub fn starts_with_ignore_ascii_case(string: &str, prefix: &str) -> bool { | |||
string.len() > prefix.len() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this should technically be >= (though it doesn't matter due to the callsites). I'll fix too.
r? @nox or @SimonSapin (or anyone else really) |
@bors-servo r=stshine |
📌 Commit 9e00efc has been approved by |
style: Fix starts_with_ignore_ascii_case. In particular, fix a panic when the input is not ASCII and we happen to index in something that is not a char boundary. This fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1379380 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17640) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
In particular, fix a panic when the input is not ASCII and we happen to index in
something that is not a char boundary.
This fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1379380
This change is