Skip to content

Commit eb3b523

Browse files
committed
fix null char handling in script content
1 parent fb1ea15 commit eb3b523

11 files changed

Lines changed: 35 additions & 5 deletions

src/main/java/org/htmlunit/cyberneko/HTMLScanner.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3883,11 +3883,15 @@ else if (c == '<') {
38833883
fScanScriptContent.append('\n');
38843884
}
38853885
}
3886-
else {
3887-
if (!fScanScriptContent.appendCodePoint(c)) {
3888-
if (fReportErrors_) {
3889-
fErrorReporter.reportError("HTML1005", new Object[] {"&#" + c + ';'});
3890-
}
3886+
else if (c == 0) {
3887+
fScanScriptContent.append('\uFFFD');
3888+
if (fReportErrors_) {
3889+
fErrorReporter.reportError("HTML1005", new Object[] {"&#" + c + ';'});
3890+
}
3891+
}
3892+
else if (!fScanScriptContent.appendCodePoint(c)) {
3893+
if (fReportErrors_) {
3894+
fErrorReporter.reportError("HTML1005", new Object[] {"&#" + c + ';'});
38913895
}
38923896
}
38933897
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(html
2+
(head
3+
(script
4+
"a='�'
5+
)script
6+
)head
7+
(body
8+
)body
9+
)html
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(script
2+
"a='�'
3+
)script
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<html><head><script>a='�'</script></head><body></body></html>

0 commit comments

Comments
 (0)