Closed serhiy-storchaka closed 5 years ago
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.
DTrace support was implemented in bpo-21590 (changeset a785c87d6eacbed81543a8afe3cb098fabb9610a).
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
I don't think that Python 3.7 should be modified. I prefer to avoid any risk and only modify Python 3.8.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at =
created_at =
labels = ['interpreter-core', 'type-bug', '3.8']
title = 'Possible integer overflow when call PyDTrace_GC_DONE()'
updated_at =
user = 'https://github.com/serhiy-storchaka'
```
bugs.python.org fields:
```python
activity =
actor = 'serhiy.storchaka'
assignee = 'none'
closed = True
closed_date =
closer = 'serhiy.storchaka'
components = ['Interpreter Core']
creation =
creator = 'serhiy.storchaka'
dependencies = []
files = []
hgrepos = []
issue_num = 32805
keywords = ['patch']
message_count = 4.0
messages = ['311870', '313857', '337329', '337330']
nosy_count = 4.0
nosy_names = ['jcea', 'vstinner', 'lukasz.langa', 'serhiy.storchaka']
pr_nums = ['11010']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue32805'
versions = ['Python 3.8']
```