Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTMLSourceTracker crashes when network packets break poorly
https://bugs.webkit.org/show_bug.cgi?id=66728 Reviewed by Darin Adler. Source/WebCore: If there is a network packet boundary in the middle of an attribute that begins with the letters "on", then the HTMLSourceTracker will get confused and try to extract too many characters from future input. If the future input is small enough, that will walk off the end of the input and crash. Test: http/tests/security/xssAuditor/crash-while-loading-tag-with-pause.html * html/parser/HTMLSourceTracker.cpp: (WebCore::HTMLSourceTracker::sourceForToken): LayoutTests: Test that we don't crash when we get a bad network packet boundary. * http/tests/security/xssAuditor/crash-while-loading-tag-with-pause-expected.txt: Added. * http/tests/security/xssAuditor/crash-while-loading-tag-with-pause.html: Added. * http/tests/security/xssAuditor/resources/tag-with-pause.php: Added. Canonical link: https://commits.webkit.org/82540@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@93561 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Adam Barth
committed
Aug 22, 2011
1 parent
6dd2b7b
commit 1938757
Showing
6 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
LayoutTests/http/tests/security/xssAuditor/crash-while-loading-tag-with-pause-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This test passes if it doesn't crash. | ||
|
8 changes: 8 additions & 0 deletions
8
LayoutTests/http/tests/security/xssAuditor/crash-while-loading-tag-with-pause.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script> | ||
if (window.layoutTestController) { | ||
layoutTestController.dumpAsText(); | ||
layoutTestController.setXSSAuditorEnabled(true); | ||
} | ||
</script> | ||
This test passes if it doesn't crash.<br> | ||
<iframe src="resources/tag-with-pause.php?onclick=alert(1)"></iframe> |
18 changes: 18 additions & 0 deletions
18
LayoutTests/http/tests/security/xssAuditor/resources/tag-with-pause.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<? | ||
header("Content-Type: text/html; charset=utf-8"); | ||
?> | ||
<!-- <?php | ||
# Spam a bunch of As to make sure we blow past any buffers. | ||
print str_repeat("A", 2048); | ||
?> --> | ||
<body> | ||
<?php | ||
print "<a ona"; | ||
print str_repeat("a", 2000); | ||
|
||
flush(); | ||
usleep(200000); | ||
|
||
print "click=alert(1) ttt>"; | ||
?> | ||
Done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters