Element extend() method does not check for inner elements sanity
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Fix Released
|
Medium
|
scoder |
Bug Description
The extend() methods does not check for inner elements sanity before appending, contrarily to the append() method. This makes it pretty easy to cause a segfault instead of just raising an exception:
from lxml.etree import Element
e = Element("foo")
e.extend([None])
Segmentation fault
See:
http://
A check should be implemented to verify the element is fine - I don't know how Cython works, if the public append() method could be called instead of _appendChild that would suffice.
System info:
Ubuntu Maverick 64 bit:
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> from lxml import etree
>>>
>>> print("%-20s: %s" % ('Python', sys.version_info))
Python : (2, 6, 6, 'final', 0)
>>> print("%-20s: %s" % ('lxml.etree', etree.LXML_
lxml.etree : (2, 2, 6, 0)
>>> print("%-20s: %s" % ('libxml used', etree.LIBXML_
libxml used : (2, 7, 7)
>>> print("%-20s: %s" % ('libxml compiled', etree.LIBXML_
libxml compiled : (2, 7, 6)
>>> print("%-20s: %s" % ('libxslt used', etree.LIBXSLT_
libxslt used : (1, 1, 26)
>>> print("%-20s: %s" % ('libxslt compiled', etree.LIBXSLT_
libxslt compiled : (1, 1, 26)
>>>
description: | updated |
Already fixed in the latest 2.3 release.