[New-bugs-announce] [issue41056] minor NULL pointer and sign issues reported by Coverity
Gregory P. Smith
report at bugs.python.org
Sat Jun 20 13:38:30 EDT 2020
New submission from Gregory P. Smith <greg at krypto.org>:
________________________________________________________________________________________________________
*** CID 1464693: Null pointer dereferences (REVERSE_INULL)
/Modules/_zoneinfo.c: 1625 in parse_abbr()
1619 ptr++;
1620 }
1621 str_end = ptr;
1622 }
1623
1624 *abbr = PyUnicode_FromStringAndSize(str_start, str_end - str_start);
>>> CID 1464693: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "abbr" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1625 if (abbr == NULL) {
1626 return -1;
1627 }
1628
1629 return ptr - p;
1630 }
________________________________________________________________________________________________________
*** CID 1464687: Null pointer dereferences (FORWARD_NULL)
/Modules/_ssl/debughelpers.c: 138 in _PySSL_keylog_callback()
132 * critical debug helper.
133 */
134 if (lock == NULL) {
135 lock = PyThread_allocate_lock();
136 if (lock == NULL) {
137 PyErr_SetString(PyExc_MemoryError, "Unable to allocate lock");
>>> CID 1464687: Null pointer dereferences (FORWARD_NULL)
>>> Passing null pointer "&ssl_obj->exc_type" to "PyErr_Fetch", which dereferences it.
138 PyErr_Fetch(&ssl_obj->exc_type, &ssl_obj->exc_value,
139 &ssl_obj->exc_tb);
140 return;
141 }
142 }
143
________________________________________________________________________________________________________
*** CID 1464684: Integer handling issues (NEGATIVE_RETURNS)
/Modules/clinic/posixmodule.c.h: 6813 in os_fpathconf()
6807 if (fd == -1 && PyErr_Occurred()) {
6808 goto exit;
6809 }
6810 if (!conv_path_confname(args[1], &name)) {
6811 goto exit;
6812 }
>>> CID 1464684: Integer handling issues (NEGATIVE_RETURNS)
>>> "fd" is passed to a parameter that cannot be negative.
6813 _return_value = os_fpathconf_impl(module, fd, name);
6814 if ((_return_value == -1) && PyErr_Occurred()) {
6815 goto exit;
6816 }
6817 return_value = PyLong_FromLong(_return_value);
6818
----------
assignee: gregory.p.smith
messages: 371946
nosy: gregory.p.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: minor NULL pointer and sign issues reported by Coverity
type: crash
versions: Python 3.10, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41056>
_______________________________________
More information about the New-bugs-announce
mailing list