summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tokeniser/tokeniser.c2
-rw-r--r--test/data/tokeniser2/test1.test6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/tokeniser/tokeniser.c b/src/tokeniser/tokeniser.c
index a756a72..1f1ae40 100644
--- a/src/tokeniser/tokeniser.c
+++ b/src/tokeniser/tokeniser.c
@@ -2811,7 +2811,7 @@ bool hubbub_tokeniser_handle_named_entity(hubbub_tokeniser *tokeniser)
return false;
cptr = parserutils_inputstream_peek(tokeniser->input,
- ctx->match_entity.offset + ctx->match_entity.length,
+ ctx->match_entity.offset + ctx->match_entity.length - 1,
&len);
c = CHAR(cptr);
diff --git a/test/data/tokeniser2/test1.test b/test/data/tokeniser2/test1.test
index 46ad7ca..e40e5f8 100644
--- a/test/data/tokeniser2/test1.test
+++ b/test/data/tokeniser2/test1.test
@@ -169,8 +169,12 @@
"input":"<h a='&noti'>",
"output":["ParseError", ["StartTag", "h", {"a":"&noti"}]]},
+{"description":"Entity in attribute with semicolon",
+"input":"<h a='&COPY;'>",
+"output":["ParseError", ["StartTag", "h", {"a":"\u00A9"}]]},
+
{"description":"Entity in attribute without semicolon",
"input":"<h a='&COPY'>",
-"output":["ParseError", ["StartTag", "h", {"a":"\u00A9"}]]}
+"output":["ParseError", ["StartTag", "h", {"a":"&COPY"}]]}
]}