[issue31758] various refleaks in _elementtree, and crashes when using an uninitialized XMLParser object

Oren Milman report at bugs.python.org
Sat Oct 14 12:39:36 EDT 2017


Oren Milman <orenmn at gmail.com> added the comment:

According to Serhiy's advice (https://bugs.python.org/issue31455#msg304338),
this issue now also includes some crashes in _elementtree:


The following code crashes:
import _elementtree
parser = _elementtree.XMLParser.__new__(_elementtree.XMLParser)
parser.close()

This is because _elementtree_XMLParser_close_impl() assumes that the XMLParser
object is initialized, and so it passes `self` to expat_parse(), which assumes
that `self->parser` is valid, and crashes.
Similarly, calling feed(), _parse_whole() or _setevents(), or reading the
`entity` or `target` attribute of an uninitialized XMLParser object would
result in a crash.


ISTM that PR 3956 is more complex, and already not so small, so i would soon
open another PR to fix these crashes.

----------
title: various refleaks in _elementtree -> various refleaks in _elementtree, and crashes when using an uninitialized XMLParser object
type: resource usage -> crash

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31758>
_______________________________________


More information about the Python-bugs-list mailing list