Skip to content

Commit

Permalink
Don't crash on invalid utf-8 in the HTML parser.
Browse files Browse the repository at this point in the history
This was regressed by the html5ever landing.
  • Loading branch information
Ms2ger committed Oct 19, 2014
1 parent 65856dd commit b9d8533
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/script/parse/html.rs
Expand Up @@ -496,7 +496,7 @@ pub fn parse_html(page: &Page,
match msg {
Payload(data) => {
// FIXME: use Vec<u8> (html5ever #34)
let data = String::from_utf8(data).unwrap();
let data = UTF_8.decode(data.as_slice(), DecodeReplace).unwrap();
parser.tokenizer().borrow_mut().feed(data);
}
Done(Err(err)) => {
Expand Down
4 changes: 3 additions & 1 deletion tests/wpt/metadata/XMLHttpRequest/open-url-encoding.htm.ini
@@ -1,3 +1,5 @@
[open-url-encoding.htm]
type: testharness
expected: CRASH
[XMLHttpRequest: open() - URL encoding]
expected: FAIL

This file was deleted.

@@ -1,3 +1,3 @@
[send-entity-body-document.htm]
type: testharness
expected: CRASH
expected: TIMEOUT

9 comments on commit b9d8533

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from Manishearth
at Ms2ger@b9d8533

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging Ms2ger/servo/parser-crash = b9d8533 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ms2ger/servo/parser-crash = b9d8533 merged ok, testing candidate = 66ec92f

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from Manishearth
at Ms2ger@b9d8533

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging Ms2ger/servo/parser-crash = b9d8533 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ms2ger/servo/parser-crash = b9d8533 merged ok, testing candidate = c123f75

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = c123f75

Please sign in to comment.