-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parser compares int
to Py_ssize_t
poorly
#120956
Labels
Comments
Opened #120959. |
Was there a specific clever static analyser that found this in this case? |
CodeQL, though running on a different copy of the repo than this one. |
lysnikolaou
added a commit
that referenced
this issue
Jun 24, 2024
mrahtz
pushed a commit
to mrahtz/cpython
that referenced
this issue
Jun 30, 2024
noahbkim
pushed a commit
to hudson-trading/cpython
that referenced
this issue
Jul 11, 2024
estyxx
pushed a commit
to estyxx/cpython
that referenced
this issue
Jul 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure how widespread this is, or how generated the code is, but within
_loop0_139_rule
inparser.c
we find this:If
_n
can never be larger than MAX_INT (likely), there seems no reason it can't beint
. Alternatively, ifi
has to increment all the way up to_n
, it should bePy_ssize_t
.Otherwise, an infinite loop is theoretically possible, and clever static analysers will take great pride in reminding us about this possibility until we fix it.
(I'd jump in and fix this myself but I've never touched this code before and am not sure where to start. Should be easy enough for someone who does know, though.)
Linked PRs
The text was updated successfully, but these errors were encountered: