Skip to content

Commit

Permalink
Fix parsing of leading zeros in named HTML entities (fixes #288)
Browse files Browse the repository at this point in the history
  • Loading branch information
earwig committed Jun 30, 2022
1 parent 6665505 commit f963df7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
v0.7 (unreleased):

- ...
- Fixed parsing of leading zeros in named HTML entities. (#288)

v0.6.4 (released February 14, 2022):

Expand Down
3 changes: 2 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ v0.7
Unreleased
(`changes <https://github.com/earwig/mwparserfromhell/compare/v0.6.4...main>`__):

- ...
- Fixed parsing of leading zeros in named HTML entities.
(`#288 <https://github.com/earwig/mwparserfromhell/issues/288>`_)

v0.6.4
------
Expand Down
2 changes: 1 addition & 1 deletion src/mwparserfromhell/parser/ctokenizer/tok_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ Tokenizer_really_parse_entity(Tokenizer *self)
}
break;
}
if (i == 0 && this == '0') {
if (i == 0 && numeric && this == '0') {
zeroes++;
self->head++;
continue;
Expand Down
7 changes: 7 additions & 0 deletions tests/tokenizer/html_entities.mwtest
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,10 @@ name: invalid_partial_amp_pound_x_semicolon
label: invalid entities: an ampersand, pound sign, and x
input: "&#x"
output: [Text(text="&#x")]

---

name: invalid_zeros_before_named
label: invalid entities: zeros before a valid named entity
input: "&000nbsp;"
output: [Text(text="&000nbsp;")]

0 comments on commit f963df7

Please sign in to comment.