Repository navigation
xpath BUGFIX evaluate comment() as an empty node set - #2665
Open
Mohil-Ahuja wants to merge 1 commit into
Open
Mohil-Ahuja wants to merge 1 commit into
Mohil-Ahuja wants to merge 1 commit into
Conversation
The tokenizer accepts comment() as a NodeType, but the evaluator only knew node() and text(), so comment() was evaluated as text() and selected the text of the context nodes (an assert caught it in debug builds). Data trees have no comment nodes, so it selects nothing now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tokenizer accepts
comment()as a NodeType (next tonode()andtext()), buteval_node_type_with_predicate()only handlesnodeandtext. A debug build fails onassert(exp->tok_len[*tok_idx] == 4), and a release build falls through toxpath_pi_text(), socomment()selects the text of the context nodes:Data trees have no comment nodes, so
comment()now always gives an empty node set, and for schema nodes it is handled the same way astext(). The test is added totest_no_valueintest_xpath.c. I found it by fuzzinglyd_eval_xpath.