[DOM] fix getNamedItemNS() with empty URI not matching null namespace - #281
Open
iliaal wants to merge 1 commit into
Open
[DOM] fix getNamedItemNS() with empty URI not matching null namespace#281iliaal wants to merge 1 commit into
iliaal wants to merge 1 commit into
Conversation
Dom\NamedNodeMap::getNamedItemNS() passed the raw empty-string URI to
xmlHasNsProp(), which only matches NULL-namespace attributes when the
URI pointer is NULL, so lookups like getNamedItemNS("", "bar") returned
NULL while hasAttributeNS("", "bar") found the attribute. Normalize an
empty URI to NULL in spec-following mode, mirroring dom_get_attribute_ns()
in element.c; sibling audit of xmlHasNsProp()/xmlGetNsProp() call sites
found no other user-supplied URI paths.
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.
Dom\NamedNodeMap::getNamedItemNS() passed the raw empty-string URI straight to xmlHasNsProp(), which only matches NULL-namespace attributes when the URI pointer is NULL, so getNamedItemNS("", "bar") returned NULL even though hasAttributeNS("", "bar") found the attribute in spec-following mode. This normalizes an empty URI to NULL at the namednodemap entry point, mirroring what dom_get_attribute_ns() already does in element.c, and adds a regression test covering both the legacy and Dom classes. Sibling audit of xmlHasNsProp() and xmlGetNsProp() call sites found no other paths that pass a user-supplied URI.