Skip to content

Commit 3aa0900

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

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
@@ -3539,7 +3539,13 @@ private void ensureBufferSpace(int inputLength) throws SAXException {
35393539
} else if ((c >= '0' && c <= '9')
35403540
|| (c >= 'A' && c <= 'Z')
35413541
|| (c >= 'a' && c <= 'z')) {
3542-
appendStrBuf(c);
3542+
if (returnState == ATTRIBUTE_VALUE_DOUBLE_QUOTED
3543+
|| returnState == ATTRIBUTE_VALUE_SINGLE_QUOTED
3544+
|| returnState == ATTRIBUTE_VALUE_UNQUOTED) {
3545+
appendStrBuf(c);
3546+
}
3547+
/* The following pos++ is necessary due to how we’ve
3548+
* handled the "reconsume" block for this case. */
35433549
pos++;
35443550
continue;
35453551
}

0 commit comments

Comments
 (0)