Skip to content

Commit 8010453

Browse files
Limit ambiguous-ampersand wasteful buffering
This refines 9ce4bd4 by only buffering if we’re actually inside an attribute value.
1 parent c7a2fce commit 8010453

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/nu/validator/htmlparser/impl/Tokenizer.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3610,7 +3610,13 @@ private void ensureBufferSpace(int inputLength) throws SAXException {
36103610
} else if ((c >= '0' && c <= '9')
36113611
|| (c >= 'A' && c <= 'Z')
36123612
|| (c >= 'a' && c <= 'z')) {
3613-
appendStrBuf(c);
3613+
if (returnState == ATTRIBUTE_VALUE_DOUBLE_QUOTED
3614+
|| returnState == ATTRIBUTE_VALUE_SINGLE_QUOTED
3615+
|| returnState == ATTRIBUTE_VALUE_UNQUOTED) {
3616+
appendStrBuf(c);
3617+
}
3618+
/* The following pos++ is necessary due to how we’ve
3619+
* handled the "reconsume" block for this case. */
36143620
pos++;
36153621
continue;
36163622
}

0 commit comments

Comments
 (0)