classification
Title: Static analysis issues reported by GCC 10
Type: Stage: patch review
Components: Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: cstratak, miss-islington, vstinner
Priority: normal Keywords: patch

Created on 2020-06-30 18:06 by cstratak, last changed 2020-07-10 10:18 by miss-islington.

Files
File name Uploaded Description Edit
debugstaticanalysis.txt cstratak, 2020-06-30 18:06
Pull Requests
URL Status Linked Edit
PR 21240 merged cstratak, 2020-06-30 18:20
PR 21431 merged miss-islington, 2020-07-10 09:59
PR 21432 merged miss-islington, 2020-07-10 09:59
Messages (5)
msg372711 - (view) Author: Charalampos Stratakis (cstratak) * Date: 2020-06-30 18:06
GCC added a static analysis tool recently [0].

Running it under for CPython code base produces some interesting results.

Reproducer: ./configure --with-pydebug && CFLAGS='-fanalyzer' make

Attaching the log.

[0] https://developers.redhat.com/blog/2020/03/26/static-analysis-in-gcc-10/
msg372713 - (view) Author: Charalampos Stratakis (cstratak) * Date: 2020-06-30 18:09
First issue in Objects/bytearrayobject.c [0].

warning: use of NULL ‘<unknown>’ where non-null expected [CWE-690] [-Wanalyzer-null-argument]
  277 |         memcpy(result->ob_bytes, va.buf, va.len);

[0] https://github.com/python/cpython/blob/master/Objects/bytearrayobject.c#L277
msg373344 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-07-08 20:39
New changeset 61fc23ca106bc82955b0e59d1ab42285b94899e2 by stratakis in branch 'master':
bpo-41175: Guard against a NULL pointer dereference within bytearrayobject (GH-21240)
https://github.com/python/cpython/commit/61fc23ca106bc82955b0e59d1ab42285b94899e2
msg373458 - (view) Author: miss-islington (miss-islington) Date: 2020-07-10 10:16
New changeset 33672c019179be279ae979f709c974593fbbbe84 by Miss Islington (bot) in branch '3.8':
bpo-41175: Guard against a NULL pointer dereference within bytearrayobject (GH-21240)
https://github.com/python/cpython/commit/33672c019179be279ae979f709c974593fbbbe84
msg373459 - (view) Author: miss-islington (miss-islington) Date: 2020-07-10 10:18
New changeset 51b36ed96d29c9440fbca18fb0c9e3087f763da5 by Miss Islington (bot) in branch '3.9':
bpo-41175: Guard against a NULL pointer dereference within bytearrayobject (GH-21240)
https://github.com/python/cpython/commit/51b36ed96d29c9440fbca18fb0c9e3087f763da5
History
Date User Action Args
2020-07-10 10:18:54miss-islingtonsetmessages: + msg373459
2020-07-10 10:16:18miss-islingtonsetmessages: + msg373458
2020-07-10 09:59:55miss-islingtonsetpull_requests: + pull_request20579
2020-07-10 09:59:28miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request20578
2020-07-08 20:39:48vstinnersetmessages: + msg373344
2020-07-02 12:10:45vstinnersetnosy: + vstinner
2020-06-30 18:20:23cstrataksetkeywords: + patch
stage: patch review
pull_requests: + pull_request20392
2020-06-30 18:09:45cstrataksetmessages: + msg372713
2020-06-30 18:06:49cstratakcreate