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

Add check for c_src_dict in _fixThreadDictPtr #229

Merged
merged 1 commit into from Mar 18, 2017

Conversation

Projects
None yet
2 participants
@tbodt
Contributor

tbodt commented Feb 26, 2017

If a document is created outside of LXML and converted to an LXML node with elementFactory, its dictionary might be NULL, which would make xmlDictOwns return -1, which counts as true. If the nodes in that document are then moved to an LXML document, fixThreadDictNsForNode would then set the href and prefix pointers to point to the dictionary, which would cause a bad free when the document gets freed.

Add check for c_src_dict in _fixThreadDictPtr
If a document is created outside of LXML and converted to an LXML node with elementFactory, its dictionary might be NULL, which would make xmlDictOwns return -1, which counts as true. If the nodes in that document are then moved to an LXML document, fixThreadDictNsForNode would then set the href and prefix pointers to point to the dictionary, which would cause a bad free when the document gets freed.
@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder Mar 18, 2017

Member

Thanks!

Member

scoder commented Mar 18, 2017

Thanks!

@scoder scoder merged commit fd9cf96 into lxml:master Mar 18, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment