Avoid panics for empty or multibyte image usemap

This commit is contained in:
Lucjan Suski 2017-03-21 19:21:09 +01:00
parent c83ac31e71
commit ee310fdc2a
3 changed files with 33 additions and 0 deletions

View file

@ -422,6 +422,11 @@ impl HTMLImageElement {
};
let value = usemap_attr.value();
if value.len() == 0 || !value.is_char_boundary(1) {
return None
}
let (first, last) = value.split_at(1);
if first != "#" || last.len() == 0 {