Copilot commented on code in PR #118:
URL: https://github.com/apache/xerces-j/pull/118#discussion_r4485372357
##########
src/org/apache/xerces/xpointer/XPointerHandler.java:
##########
@@ -236,10 +236,11 @@ protected void addToken(Tokens tokens, int token)
closeParenCount++;
while (tokens.hasMore()) {
- if (tokens.getTokenString(tokens.peekToken()) !=
"XPTRTOKEN_OPEN_PAREN") {
+ if (tokens.peekToken() != Tokens.XPTRTOKEN_CLOSE_PAREN) {
break;
}
closeParenCount++;
+ tokens.nextToken();
Review Comment:
Consuming these closing parentheses makes the malformed expression
`element((/1))` succeed: the earlier loop discards the extra opening
parenthesis, so `ElementSchemePointer` receives `/1` and selects the root
element. Reject extra wrapping parentheses for the `element` scheme before
parsing its data. Add a regression case for this balanced but malformed
expression.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]