mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Handle multibyte characters in img srcset (#33873)
This was causing this web platform test to crash: https://wpt.fyi/results/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html Signed-off-by: evuez <julien@mulga.net>
This commit is contained in:
parent
2d796a2719
commit
72ff89620b
2 changed files with 168 additions and 5 deletions
|
@ -2011,8 +2011,8 @@ pub fn parse_a_srcset_attribute(input: &str) -> Vec<ImageSource> {
|
|||
// > that position is past the end of input.
|
||||
let mut characters = descriptors_string.chars();
|
||||
let mut character = characters.next();
|
||||
if character.is_some() {
|
||||
current_index += 1;
|
||||
if let Some(character) = character {
|
||||
current_index += character.len_utf8();
|
||||
}
|
||||
|
||||
loop {
|
||||
|
@ -2086,8 +2086,8 @@ pub fn parse_a_srcset_attribute(input: &str) -> Vec<ImageSource> {
|
|||
}
|
||||
|
||||
character = characters.next();
|
||||
if character.is_some() {
|
||||
current_index += 1;
|
||||
if let Some(character) = character {
|
||||
current_index += character.len_utf8();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue