New submission from Erlend Egeberg Aasland <erlend.aasl...@innova.no>:

_PyArena_AddPyObject() only steals the object reference if successful.

- In Parser/pegen.c, _PyPegen_fill_token(), the return value is not checked at 
all.
- In Parser/asdl_c.py, none of the (two) calls to _PyArena_AddPyObject() decref 
on failure
- Ditto for Python/Python-ast.c


Attached patch fixes all callers. I'll put up a PR if it looks ok.

Alternatively, one could make _PyArena_AddPyObject() _not_ steal the reference, 
but since it's an exposed API, that's probably not an option.

----------
files: patch.diff
keywords: patch
messages: 390559
nosy: erlendaasland, pablogsal
priority: normal
severity: normal
status: open
title: Fix possible _PyArena_AddPyObject ref leaks
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file49943/patch.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43779>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to