New submission from Alexey Izbyshev <izbys...@ispras.ru>:

The return value of PyTuple_GetSlice() at 
https://github.com/python/cpython/blob/48ce4897f8f8d91d948ecd1241ffab002df2be9e/Objects/typeobject.c#L2297
 is not checked for NULL and then dereferenced.

Reported by Svace static analyzer.

Currently, PyTuple_GetSlice() for a zero-length slice can fail only if it's the 
first zero-length tuple ever created. If there is an invariant that at least 
one zero-length tuple exists on any type_init() call, the check may be replaced 
with an assert.

----------
components: Interpreter Core
messages: 323951
nosy: berker.peksag, izbyshev, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Objects/typeobject.c: Missing NULL check in type_init()
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

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

Reply via email to