This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Double decref in _elementtree.Element.__getstate__
Type: crash Stage: resolved
Components: Extension Modules, XML Versions: Python 3.9, Python 3.8, Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eli.bendersky, miss-islington, scoder, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2020-03-08 12:24 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18850 merged serhiy.storchaka, 2020-03-08 12:27
PR 18874 merged miss-islington, 2020-03-09 12:37
PR 18875 merged miss-islington, 2020-03-09 12:37
Messages (4)
msg363657 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-08 12:24
There is very strange code in _elementtree.Element.__getstate__ which decrement references to elements of a list before decrementing a reference to the list itself. It happens only if creating a dict fails, so it is almost impossible to reproduce, but if it happens it will likely cause a crash.

The proposed PR fixes the bug and also simplifies the code.
msg363724 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-09 12:37
New changeset 88944a44aa84b0f3674939019b1befbc7a9dc874 by Serhiy Storchaka in branch 'master':
bpo-39903: Fix double decref in _elementtree.Element.__getstate__ (GH-18850)
msg363725 - (view) Author: miss-islington (miss-islington) Date: 2020-03-09 12:53
New changeset 80be9c344f9fa619c24712c699b70126fc202315 by Miss Islington (bot) in branch '3.7':
bpo-39903: Fix double decref in _elementtree.Element.__getstate__ (GH-18850)
msg363726 - (view) Author: miss-islington (miss-islington) Date: 2020-03-09 12:55
New changeset 97bbdb28b4ab9519780f924e3267ac70af1cd5b8 by Miss Islington (bot) in branch '3.8':
bpo-39903: Fix double decref in _elementtree.Element.__getstate__ (GH-18850)
Date User Action Args
2022-04-11 14:59:27adminsetgithub: 84084
2020-03-09 13:10:21serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-03-09 12:55:21miss-islingtonsetmessages: + msg363726
2020-03-09 12:53:32miss-islingtonsetmessages: + msg363725
2020-03-09 12:37:32miss-islingtonsetpull_requests: + pull_request18233
2020-03-09 12:37:24miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request18232
2020-03-09 12:37:12serhiy.storchakasetmessages: + msg363724
2020-03-08 12:27:20serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request18207
2020-03-08 12:24:04serhiy.storchakacreate