summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/Parser
diff options
context:
space:
mode:
authorAdam Hodgen <ant1441@gmail.com>2022-02-18 22:12:47 +0000
committerAndreas Kling <kling@serenityos.org>2022-02-21 16:31:45 +0100
commitc6fcdd0f93cd8c49a6024a65d808b69b701e7ecc (patch)
treeb7ecdfb56a5cbfe021c4fca5208394d793304337 /Userland/Libraries/LibWeb/HTML/Parser
parentc6dd8a1f66651e30993c8dda8bd9b2bb9ea98b18 (diff)
downloadserenity-c6fcdd0f93cd8c49a6024a65d808b69b701e7ecc.zip
LibWeb: Fix off by one error in HTML Tokenizer
In 'NamedCharacterReference' we attempt to lookup the code point by a identifier, eg apos; becomes ' This is done by passing the entire rest of the document to the `HTML::code_points_from_entity` function. However, before this change we didn't sent the final character which meant if the document ended in a named character reference the lookup would fail.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/Parser')
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp
index 6fad045f43..48190ad95f 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp
@@ -1617,7 +1617,7 @@ _StartOfFunction:
{
size_t byte_offset = m_utf8_view.byte_offset_of(m_prev_utf8_iterator);
- auto match = HTML::code_points_from_entity(m_decoded_input.substring_view(byte_offset, m_decoded_input.length() - byte_offset - 1));
+ auto match = HTML::code_points_from_entity(m_decoded_input.substring_view(byte_offset, m_decoded_input.length() - byte_offset));
if (match.has_value()) {
skip(match->entity.length() - 1);