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: Possible integer overflow when call PyDTrace_GC_DONE()
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jcea, lukasz.langa, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2018-02-09 09:27 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11010 merged jkloth, 2018-12-07 06:13
Messages (4)
msg311870 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-02-09 09:27
PyDTrace_GC_DONE() accepts the argument of type int. But it is called with the sum of collected and uncollectable objects which has type Py_ssize_t and can be larger that maximal int.

This produces a compiler warning on Windows:

..\Modules\gcmodule.c(978): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data [D:\buildarea\3.x.bolen-windows10\build\PCbuild\pythoncore.vcxproj]

and looks as not false alarm.
msg313857 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-03-15 08:31
DTrace support was implemented in issue21590 (changeset a785c87d6eacbed81543a8afe3cb098fabb9610a).
msg337329 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-03-06 17:00
The warning in the C code has been fixed by:

New changeset edad38e3e05586ba58291f47756eb3fb808f5577 by Victor Stinner (Jeremy Kloth) in branch 'master':
bpo-9566: Fix compiler warnings in gcmodule.c (GH-11010)
https://github.com/python/cpython/commit/edad38e3e05586ba58291f47756eb3fb808f5577

The remaining question is if Include/pydtrace.d must be updated or not:
https://github.com/python/cpython/pull/11010#issuecomment-470187843
msg337330 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-03-06 17:05
I don't think that Python 3.7 should be modified. I prefer to avoid any risk and only modify Python 3.8.
History
Date User Action Args
2022-04-11 14:58:57adminsetgithub: 76986
2019-08-31 20:29:43serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-03-06 17:05:39vstinnersetmessages: + msg337330
versions: - Python 3.6, Python 3.7
2019-03-06 17:00:47vstinnersetnosy: + vstinner
messages: + msg337329
2018-12-07 06:13:39jklothsetkeywords: + patch
stage: patch review
pull_requests: + pull_request10247
2018-03-15 08:31:18serhiy.storchakasetnosy: + jcea

messages: + msg313857
versions: + Python 3.6
2018-02-09 09:27:39serhiy.storchakacreate