Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing possible memory corruption in doc dictionary if node is moved between docs #268

Merged
merged 1 commit into from
Aug 3, 2018

Conversation

weggerle-a
Copy link
Contributor

etree.insert function tries to handle the case when a node is moved
between documents with the function moveNodeToDocument. So far the
source_doc is taken from the destination child node which is wrong.
The moveNodeToDocument function will not fix the names in the
document dictionaries because source and target doc are the same.

The fix takes now the source_doc from the node element which
should be inserted.

This fixes issue https://bugs.launchpad.net/lxml/+bug/1773749

etree.insert function tries to handle the case when a node is moved
between documents with the function moveNodeToDocument. So far the
source_doc is taken from the destination node which is wrong.
The moveNodeToDocument function will not fix the names in the
document dictionaries because source and target doc are the same.

The fix takes now the source_doc from the node element which
should be inserted.

This fixes issue https://bugs.launchpad.net/lxml/+bug/1773749
@scoder
Copy link
Member

scoder commented Aug 3, 2018

Interesting bug. Thanks!

@scoder scoder merged commit 93f0c0d into lxml:master Aug 3, 2018
scoder added a commit that referenced this pull request Aug 3, 2018
@scoder
Copy link
Member

scoder commented Aug 3, 2018

Fix released in lxml 4.2.4.

scoder added a commit that referenced this pull request Aug 3, 2018
@weggerle-a
Copy link
Contributor Author

Thanks for the fast merge and new release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants