Content-Length: 279145 | pFad | https://github.com/python/cpython/issues/148801

22 Unbounded C recursion in `_elementtree.Element.__deepcopy__` causes causes stack overflow · Issue #148801 · python/cpython · GitHub
Skip to content

Unbounded C recursion in _elementtree.Element.__deepcopy__ causes causes stack overflow #148801

@StanFromIreland

Description

@StanFromIreland

Crash report

What happened?

Many thanks to Gil Portnoy (@dhkts1) for finding this.


import xml.etree.ElementTree as ET
import sys
import copy

root = ET.Element("r")
cur = root
for i in range(500_000):
    c = ET.Element("n")
    cur.append(c)
    cur = c

copy.deepcopy(root)  # SIGSEGV

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Output from running 'python -VV' on the command line:

No response

Linked PRs

Metadata

Metadata

Labels

extension-modulesC modules in the Modules dirtopic-XMLtype-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/148801

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy