Repository navigation
Conversation
domClearPSVI checked tree->type == XML_ATTRIBUTE_NODE inside a block where tree->type was already known to be XML_ELEMENT_NODE, making the condition always false. Attribute psvi pointers were never cleared, leaving stale/dangling pointers after schema revalidation. Also replace direct buffer->content field access in domGetNodeValue with xmlBufferContent()/xmlBufferLength() API calls, matching the style used throughout LibXML.xs and perl-libxml-mm.c. The direct field access would fail if libxml2 makes xmlBuffer opaque.
Contributor
|
Note that #273 addresses the buffer API issue more comprehensively. |
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.
What
Fix dead code in
domClearPSVIthat prevented attribute PSVI clearing, and modernizexmlBufferaccess indomGetNodeValue.Why
domClearPSVIat line 33 checkedtree->type == XML_ATTRIBUTE_NODEinside a block guarded bytree->type == XML_ELEMENT_NODE— the condition was always false. Attributepsvipointers were never cleared between schema revalidations, leaving stale/dangling pointers.The
buffer->contentdirect field access indomGetNodeValueworks on current libxml2 but will fail if the struct is made opaque (as upstream has been moving toward since 2.12). The rest of the codebase already usesxmlBufferContent()/xmlBufferLength().How
XML_ATTRIBUTE_NODEtype, so clearpsviunconditionally.buffer->contentwithxmlBufferContent(buffer)and the NULL check withxmlBufferLength(buffer) > 0.Testing
Full test suite passes. New test in
t/26schema.tvalidates a document with typed attributes twice in succession.Quality Report
Changes: 2 files changed, 40 insertions(+), 6 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan