[issue36292] Coverity scan: Resource leaks in longobject.c

2019-03-18 Thread STINNER Victor


STINNER Victor  added the comment:

I hope that the change will satisfy the god of static analyzers :-)

I discussed with Charalampos and we agreed to not backport this change, since 
it's a false alarm and not a real bug. I close the issue.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36292] Coverity scan: Resource leaks in longobject.c

2019-03-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset a10d426bab66a4e1f20d5e1b9aee3dbb435cf309 by Victor Stinner 
(stratakis) in branch 'master':
bpo-36292:  Mark unreachable code as such in long bitwise ops (GH-12333)
https://github.com/python/cpython/commit/a10d426bab66a4e1f20d5e1b9aee3dbb435cf309


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36292] Coverity scan: Resource leaks in longobject.c

2019-03-14 Thread Charalampos Stratakis


Charalampos Stratakis  added the comment:

This code is unreachable. Will mark it as such.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36292] Coverity scan: Resource leaks in longobject.c

2019-03-14 Thread Charalampos Stratakis


Change by Charalampos Stratakis :


--
versions:  -Python 2.7, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36292] Coverity scan: Resource leaks in longobject.c

2019-03-14 Thread Charalampos Stratakis


Change by Charalampos Stratakis :


--
keywords: +patch
pull_requests: +12304
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36292] Coverity scan: Resource leaks in longobject.c

2019-03-14 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36292] Coverity scan: Resource leaks in longobject.c

2019-03-14 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36292] Coverity scan: Resource leaks in longobject.c

2019-03-14 Thread Charalampos Stratakis


New submission from Charalampos Stratakis :

The coverity scan was run on python2, however the same defect seems to exist in 
python3 as well.

Error: RESOURCE_LEAK (CWE-772): [#def69]
Python-2.7.15/Objects/longobject.c:3793: alloc_fn: Storage is returned from 
allocation function "_PyLong_New".
Python-2.7.15/Objects/longobject.c:76:5: alloc_fn: Storage is returned from 
allocation function "PyObject_Malloc".
Python-2.7.15/Objects/obmalloc.c:982:5: alloc_fn: Storage is returned from 
allocation function "malloc".
Python-2.7.15/Objects/obmalloc.c:982:5: return_alloc_fn: Directly returning 
storage allocated by "malloc".
Python-2.7.15/Objects/longobject.c:76:5: identity_transfer: Passing 
"(PyVarObject *)PyObject_Malloc((size_t)(PyLong_Type.tp_basicsize + size * 
PyLong_Type.tp_itemsize + 7L & 0xfff8L))" as argument 1 to function 
"PyObject_InitVar", which returns that argument.
Python-2.7.15/Objects/object.c:237:5: return_parm: Returning parameter "op".
Python-2.7.15/Objects/longobject.c:76:5: return_alloc_fn: Directly returning 
storage allocated by "PyObject_InitVar".
Python-2.7.15/Objects/longobject.c:3793: var_assign: Assigning: "z" = storage 
returned from "_PyLong_New(size_a)".
Python-2.7.15/Objects/longobject.c:3797: var_assign: Assigning: "a" = "z".
Python-2.7.15/Objects/longobject.c:3847: leaked_storage: Variable "z" going out 
of scope leaks the storage it points to.
Python-2.7.15/Objects/longobject.c:3847: leaked_storage: Returning without 
freeing "a" leaks the storage that it points to.
 3845|   default:
 3846|   PyErr_BadArgument();
 3847|-> return NULL;
 3848|   }
 3849|   

Error: RESOURCE_LEAK (CWE-772): [#def70]
Python-2.7.15/Objects/longobject.c:3793: alloc_fn: Storage is returned from 
allocation function "_PyLong_New".
Python-2.7.15/Objects/longobject.c:76:5: alloc_fn: Storage is returned from 
allocation function "PyObject_Malloc".
Python-2.7.15/Objects/obmalloc.c:982:5: alloc_fn: Storage is returned from 
allocation function "malloc".
Python-2.7.15/Objects/obmalloc.c:982:5: return_alloc_fn: Directly returning 
storage allocated by "malloc".
Python-2.7.15/Objects/longobject.c:76:5: identity_transfer: Passing 
"(PyVarObject *)PyObject_Malloc((size_t)(PyLong_Type.tp_basicsize + size * 
PyLong_Type.tp_itemsize + 7L & 0xfff8L))" as argument 1 to function 
"PyObject_InitVar", which returns that argument.
Python-2.7.15/Objects/object.c:237:5: return_parm: Returning parameter "op".
Python-2.7.15/Objects/longobject.c:76:5: return_alloc_fn: Directly returning 
storage allocated by "PyObject_InitVar".
Python-2.7.15/Objects/longobject.c:3793: var_assign: Assigning: "z" = storage 
returned from "_PyLong_New(size_a)".
Python-2.7.15/Objects/longobject.c:3797: var_assign: Assigning: "a" = "z".
Python-2.7.15/Objects/longobject.c:3820: var_assign: Assigning: "z" = "a".
Python-2.7.15/Objects/longobject.c:3820: var_assign: Assigning: "b" = "z".
Python-2.7.15/Objects/longobject.c:3847: leaked_storage: Variable "z" going out 
of scope leaks the storage it points to.
Python-2.7.15/Objects/longobject.c:3847: leaked_storage: Returning without 
freeing "b" leaks the storage that it points to.
 3845|   default:
 3846|   PyErr_BadArgument();
 3847|-> return NULL;
 3848|   }
 3849|

--
components: Interpreter Core
messages: 337933
nosy: cstratak
priority: normal
severity: normal
status: open
title: Coverity scan: Resource leaks in longobject.c
versions: Python 2.7, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com