This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: minor NULL pointer and sign issues reported by Coverity
Type: crash Stage: resolved
Components: Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: christian.heimes, gregory.p.smith, miss-islington, p-ganssle
Priority: normal Keywords: patch

Created on 2020-06-20 17:38 by gregory.p.smith, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 21007 merged gregory.p.smith, 2020-06-20 17:39
PR 21009 merged gregory.p.smith, 2020-06-20 17:44
PR 21011 merged gregory.p.smith, 2020-06-20 18:27
PR 21013 merged gregory.p.smith, 2020-06-20 19:08
PR 21014 merged miss-islington, 2020-06-20 19:15
PR 21015 merged miss-islington, 2020-06-20 19:15
PR 21039 merged miss-islington, 2020-06-22 07:27
PR 21041 merged miss-islington, 2020-06-22 07:27
PR 21083 merged p-ganssle, 2020-06-23 14:09
Messages (12)
msg371946 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2020-06-20 17:38
________________________________________________________________________________________________________
*** 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
msg371955 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2020-06-20 18:43
those were the three in the email (20 of 106), i need to figure out how to login to coverity again to see the rest.
msg371957 - (view) Author: miss-islington (miss-islington) Date: 2020-06-20 19:15
New changeset eb0d5c38de7f970d8cd8524f4163d831c7720f51 by Gregory P. Smith in branch 'master':
bpo-41056: Fix a NULL pointer dereference on MemoryError within the ssl module. (GH-21009)
https://github.com/python/cpython/commit/eb0d5c38de7f970d8cd8524f4163d831c7720f51
msg371958 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-06-20 19:17
I figured out how to run coverity scan builds again. It turned out the tool chain doesn't like GCC 10. clang 10 works, though.

By the way I'm using login with Github.
msg371968 - (view) Author: miss-islington (miss-islington) Date: 2020-06-20 22:07
New changeset 3ccb96c9782480e5ce646a4a130569fb92f2965d by Gregory P. Smith in branch 'master':
bpo-41056: Use the fildes converter for fd to please Coverity. (GH-21011)
https://github.com/python/cpython/commit/3ccb96c9782480e5ce646a4a130569fb92f2965d
msg372011 - (view) Author: miss-islington (miss-islington) Date: 2020-06-21 19:11
New changeset 10bf6e482328f622f4b2659e4ad5e3d88f57ba58 by Miss Islington (bot) in branch '3.8':
bpo-41056: Fix a NULL pointer dereference on MemoryError within the ssl module. (GH-21009)
https://github.com/python/cpython/commit/10bf6e482328f622f4b2659e4ad5e3d88f57ba58
msg372012 - (view) Author: miss-islington (miss-islington) Date: 2020-06-21 19:11
New changeset fbf94af2af3c09493481b8559b84f6e9f0628c37 by Miss Islington (bot) in branch '3.9':
bpo-41056: Fix a NULL pointer dereference on MemoryError within the ssl module. (GH-21009)
https://github.com/python/cpython/commit/fbf94af2af3c09493481b8559b84f6e9f0628c37
msg372036 - (view) Author: miss-islington (miss-islington) Date: 2020-06-22 07:27
New changeset 81328f30703bd7225e7e73aedb0994a7293ce190 by Gregory P. Smith in branch 'master':
bpo-41056: Fix reference to deallocated stack in pathconfig (Coverity) (GH-21013)
https://github.com/python/cpython/commit/81328f30703bd7225e7e73aedb0994a7293ce190
msg372037 - (view) Author: miss-islington (miss-islington) Date: 2020-06-22 07:39
New changeset d780fa7931d8ce94994827232d7cca79b0be3bf1 by Gregory P. Smith in branch 'master':
bpo-41056: Fix a possible MemoryError leak within zoneinfo. (GH-21007)
https://github.com/python/cpython/commit/d780fa7931d8ce94994827232d7cca79b0be3bf1
msg372040 - (view) Author: miss-islington (miss-islington) Date: 2020-06-22 07:43
New changeset d5ee9b9940ba24120838b07061058afe931cfff1 by Miss Islington (bot) in branch '3.8':
bpo-41056: Fix reference to deallocated stack in pathconfig (Coverity) (GH-21013)
https://github.com/python/cpython/commit/d5ee9b9940ba24120838b07061058afe931cfff1
msg372041 - (view) Author: miss-islington (miss-islington) Date: 2020-06-22 07:48
New changeset 9fe5decf5f38ae247f4f354dee27e4bfbe8bc5f8 by Miss Islington (bot) in branch '3.9':
bpo-41056: Fix reference to deallocated stack in pathconfig (Coverity) (GH-21013)
https://github.com/python/cpython/commit/9fe5decf5f38ae247f4f354dee27e4bfbe8bc5f8
msg372256 - (view) Author: Paul Ganssle (p-ganssle) * (Python committer) Date: 2020-06-24 15:58
New changeset 6c56356109616ea1292aafa48d30536279ec0937 by Paul Ganssle in branch '3.9':
[3.9] bpo-41056: Fix a possible MemoryError leak within zoneinfo. (GH-21007)
https://github.com/python/cpython/commit/6c56356109616ea1292aafa48d30536279ec0937
History
Date User Action Args
2022-04-11 14:59:32adminsetgithub: 85228
2020-10-21 19:52:52p-gansslesetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-06-24 15:58:54p-gansslesetmessages: + msg372256
2020-06-23 14:09:59p-gansslesetnosy: + p-ganssle
pull_requests: + pull_request20249
2020-06-22 07:48:01miss-islingtonsetmessages: + msg372041
2020-06-22 07:43:45miss-islingtonsetmessages: + msg372040
2020-06-22 07:39:39miss-islingtonsetmessages: + msg372037
2020-06-22 07:27:49miss-islingtonsetpull_requests: + pull_request20212
2020-06-22 07:27:42miss-islingtonsetpull_requests: + pull_request20210
2020-06-22 07:27:24miss-islingtonsetmessages: + msg372036
2020-06-21 19:11:44miss-islingtonsetmessages: + msg372012
2020-06-21 19:11:37miss-islingtonsetmessages: + msg372011
2020-06-20 22:07:03miss-islingtonsetmessages: + msg371968
2020-06-20 19:17:20christian.heimessetnosy: + christian.heimes
messages: + msg371958
2020-06-20 19:15:27miss-islingtonsetpull_requests: + pull_request20189
2020-06-20 19:15:19miss-islingtonsetpull_requests: + pull_request20188
2020-06-20 19:15:07miss-islingtonsetnosy: + miss-islington
messages: + msg371957
2020-06-20 19:08:15gregory.p.smithsetpull_requests: + pull_request20187
2020-06-20 18:43:37gregory.p.smithsetmessages: + msg371955
2020-06-20 18:27:34gregory.p.smithsetpull_requests: + pull_request20185
2020-06-20 17:44:55gregory.p.smithsetpull_requests: + pull_request20183
2020-06-20 17:39:22gregory.p.smithsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request20181
2020-06-20 17:38:30gregory.p.smithcreate