Skip to content

Commit 73674f6

Browse files
committed
Merge pull request #59 from html5lib/ncroverflow
Add tests for integer overflow when a signed 32-bit integer is used for holding the numeric character reference value.
2 parents e633ddf + c76518c commit 73674f6

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

tokenizer/numericEntities.test

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
{"tests": [
22

3+
{"description": "Invalid unterminated numeric entity character overflow before EOF",
4+
"input": "&#11111111111",
5+
"output": ["ParseError", "ParseError", ["Character", "\uFFFD"]]},
6+
7+
{"description": "Invalid unterminated numeric entity character overflow before EOF",
8+
"input": "&#1111111111",
9+
"output": ["ParseError", "ParseError", ["Character", "\uFFFD"]]},
10+
11+
{"description": "Invalid unterminated numeric entity character overflow before EOF",
12+
"input": "&#111111111111",
13+
"output": ["ParseError", "ParseError", ["Character", "\uFFFD"]]},
14+
15+
{"description": "Invalid unterminated numeric entity character overflow",
16+
"input": "&#11111111111x",
17+
"output": ["ParseError", "ParseError", ["Character", "\uFFFDx"]]},
18+
19+
{"description": "Invalid unterminated numeric entity character overflow",
20+
"input": "&#1111111111x",
21+
"output": ["ParseError", "ParseError", ["Character", "\uFFFDx"]]},
22+
23+
{"description": "Invalid unterminated numeric entity character overflow",
24+
"input": "&#111111111111x",
25+
"output": ["ParseError", "ParseError", ["Character", "\uFFFDx"]]},
26+
27+
{"description": "Invalid numeric entity character overflow",
28+
"input": "�",
29+
"output": ["ParseError", ["Character", "\uFFFD"]]},
30+
31+
{"description": "Invalid numeric entity character overflow",
32+
"input": "�",
33+
"output": ["ParseError", ["Character", "\uFFFD"]]},
34+
35+
{"description": "Invalid numeric entity character overflow",
36+
"input": "�",
37+
"output": ["ParseError", ["Character", "\uFFFD"]]},
38+
339
{"description": "Invalid numeric entity character U+0000",
440
"input": "�",
541
"output": ["ParseError", ["Character", "\uFFFD"]]},

tree-construction/entities01.dat

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,3 +721,72 @@ FOO�ZOO
721721
| <head>
722722
| <body>
723723
| "FOO�ZOO"
724+
725+
#data
726+
FOO&#11111111111
727+
#errors
728+
(1,3): expected-doctype-but-got-chars
729+
(1,13): illegal-codepoint-for-numeric-entity
730+
(1,13): eof-in-numeric-entity
731+
#document
732+
| <html>
733+
| <head>
734+
| <body>
735+
| "FOO�"
736+
737+
#data
738+
FOO&#1111111111
739+
#errors
740+
(1,3): expected-doctype-but-got-chars
741+
(1,13): illegal-codepoint-for-numeric-entity
742+
(1,13): eof-in-numeric-entity
743+
#document
744+
| <html>
745+
| <head>
746+
| <body>
747+
| "FOO�"
748+
749+
#data
750+
FOO&#111111111111
751+
#errors
752+
(1,3): expected-doctype-but-got-chars
753+
(1,13): illegal-codepoint-for-numeric-entity
754+
(1,13): eof-in-numeric-entity
755+
#document
756+
| <html>
757+
| <head>
758+
| <body>
759+
| "FOO�"
760+
761+
#data
762+
FOO&#11111111111ZOO
763+
#errors
764+
(1,3): expected-doctype-but-got-chars
765+
(1,13): illegal-codepoint-for-numeric-entity
766+
#document
767+
| <html>
768+
| <head>
769+
| <body>
770+
| "FOO�ZOO"
771+
772+
#data
773+
FOO&#1111111111ZOO
774+
#errors
775+
(1,3): expected-doctype-but-got-chars
776+
(1,13): illegal-codepoint-for-numeric-entity
777+
#document
778+
| <html>
779+
| <head>
780+
| <body>
781+
| "FOO�ZOO"
782+
783+
#data
784+
FOO&#111111111111ZOO
785+
#errors
786+
(1,3): expected-doctype-but-got-chars
787+
(1,13): illegal-codepoint-for-numeric-entity
788+
#document
789+
| <html>
790+
| <head>
791+
| <body>
792+
| "FOO�ZOO"

0 commit comments

Comments
 (0)