[New-bugs-announce] [issue35680] [2.7] Coverity scan: Passing freed pointer "name" as an argument to "Py_BuildValue" in _bsddb module.

Charalampos Stratakis report at bugs.python.org
Mon Jan 7 11:41:05 EST 2019


New submission from Charalampos Stratakis <cstratak at redhat.com>:

Results from a recent static analysis scan for python2:

Error: USE_AFTER_FREE (CWE-825):
Python-2.7.15/Modules/_bsddb.c:6697: freed_arg: "free" frees "name".
Python-2.7.15/Modules/_bsddb.c:6715: pass_freed_arg: Passing freed pointer "name" as an argument to "Py_BuildValue".

6713|       RETURN_IF_ERR();  /* Maybe the size is not the problem */
6714|   
6715|->     retval = Py_BuildValue("s", name);
6716|       free(name);
6717|       return retval;

Attaching a draft patch.

----------
components: Extension Modules
files: bsddb_fix.patch
keywords: patch
messages: 333176
nosy: cstratak
priority: normal
severity: normal
status: open
title: [2.7] Coverity scan: Passing freed pointer "name" as an argument to "Py_BuildValue" in _bsddb module.
versions: Python 2.7
Added file: https://bugs.python.org/file48028/bsddb_fix.patch

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


More information about the New-bugs-announce mailing list