[New-bugs-announce] [issue38042] Crash on double list(lxml.etree.iterparse(f)) Edit

Alexander Kurakin report at bugs.python.org
Thu Sep 5 16:50:01 EDT 2019


New submission from Alexander Kurakin <kuraga333 at mail.ru>:

I have a crash in Python 3.x environments and don't have in 2.7.

===

Crashes in:

Python 3.7.4, Anaconda, Linux 64bit, lxml 4.3.3
OR
Python 3.7.4, Anaconda, Linux 64bit, lxml 4.4.1
OR
Python 3.6.5, Gentoo Linux 64bit, lxml 4.3.3

test.py:

import lxml
import lxml.etree

with open('test.xml', 'rb') as f:
    list(
        lxml.etree.iterparse(f)
    )

    # Traceback (most recent call last):
    # File "test.py", line 18, in <module>
    # lxml.etree.iterparse(f)
    # File "src/lxml/iterparse.pxi", line 209, in lxml.etree.iterparse.__next__
    # File "src/lxml/iterparse.pxi", line 194, in lxml.etree.iterparse.__next__
    # File "src/lxml/iterparse.pxi", line 225, in lxml.etree.iterparse._read_more_events
    # File "src/lxml/parser.pxi", line 1380, in lxml.etree._FeedParser.close
    # Segmentation fault
    list(
        lxml.etree.iterparse(f)
    )

test.xml:

<?xml version="1.0" encoding="UTF-8"?>
<root></root>

(or any else)

GDB's backtrace see in attachment.

===

Doesn't crash in:

Python 2.7.15, Gentoo Linux 64bit, lxml 4.3.3

# Traceback (most recent call last):
#   File "test.py", line 19, in <module>
#     lxml.etree.iterparse(f)
#   File "src/lxml/iterparse.pxi", line 209, in lxml.etree.iterparse.__next__
#    File "/home/sasha/_lxml-bug/test.xml", line 0
lxml.etree.XMLSyntaxError: no element found

===

See also: https://bugs.launchpad.net/lxml/+bug/1833050

----------
files: bt.txt
messages: 351222
nosy: kuraga
priority: normal
severity: normal
status: open
title: Crash on double list(lxml.etree.iterparse(f)) Edit
type: crash
versions: Python 3.6, Python 3.7
Added file: https://bugs.python.org/file48595/bt.txt

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


More information about the New-bugs-announce mailing list