mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Explicitly disallow skipping 0 characters in HTML tokenizer
Previously, this caused the source position of an ambiguous ampersand to be incorrect.
This commit is contained in:
parent
9037f4e832
commit
478cf4f42c
Notes:
github-actions[bot]
2025-11-06 10:01:16 +00:00
Author: https://github.com/tcl3
Commit: 478cf4f42c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6716
2 changed files with 11 additions and 1 deletions
|
|
@ -220,6 +220,7 @@ Optional<u32> HTMLTokenizer::next_code_point(StopAtInsertionPoint stop_at_insert
|
|||
|
||||
void HTMLTokenizer::skip(size_t count)
|
||||
{
|
||||
VERIFY(count > 0);
|
||||
if (!m_source_positions.is_empty())
|
||||
m_source_positions.append(m_source_positions.last());
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
|
|
@ -1725,7 +1726,7 @@ _StartOfFunction:
|
|||
auto num_consumed = m_temporary_buffer.size() - starting_consumed_count;
|
||||
if (num_consumed == 0) {
|
||||
DONT_CONSUME_NEXT_INPUT_CHARACTER;
|
||||
} else {
|
||||
} else if (num_consumed > 1) {
|
||||
skip(num_consumed - 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue