You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Possible overflow in typeobject.c:tail_contains #126862
For this to trigger you'd need a class with over 2**32 base classes, right? I currently have a Python terminal open where I'm trying to generate 2**32 classes to test this, and it's been running for more than half an hour already. It's probably OK to change int to Py_ssize_t here for cleanliness, but let's not add a unit test that attempts to trigger this condition.
Reacted by sobolevn, Sergey B Kirpichev, Nice Zombies and Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
I'll close this one as completed since we changed int to Py_ssize_t for cleanliness (well, whence + 1 could still overflow, but this is in the infeasible realm)
Activity
picnixz commentedon Nov 15, 2024
This one is used in
and for the MRO resolution. Unless we have a VERY huge list of parent classes, I don't think we would hit the overflow.
picnixz commentedon Nov 15, 2024
cc @JelleZijlstra
federicovalenso commentedon Nov 15, 2024
@picnixz , should I try to overflow inheritance list? :) Or is there already protection against this?
picnixz commentedon Nov 15, 2024
Yes, if you can make it happen! (I don't know whether there's a protection)
JelleZijlstra commentedon Nov 15, 2024
For this to trigger you'd need a class with over 2**32 base classes, right? I currently have a Python terminal open where I'm trying to generate 2**32 classes to test this, and it's been running for more than half an hour already. It's probably OK to change int to Py_ssize_t here for cleanliness, but let's not add a unit test that attempts to trigger this condition.
gh-126862: Use `Py_ssize_t` instead of `int` when processing the numb…
pythongh-126862: Use `Py_ssize_t` instead of `int` when processing th…
pythongh-126862: Use `Py_ssize_t` instead of `int` when processing th…
[3.12] gh-126862: Use `Py_ssize_t` instead of `int` when processing t…
[3.13] gh-126862: Use `Py_ssize_t` instead of `int` when processing t…
picnixz commentedon Jan 11, 2025
I'll close this one as completed since we changed
inttoPy_ssize_tfor cleanliness (well,whence + 1could still overflow, but this is in the infeasible realm)