-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Check tokens[0] after allocating memory #95355
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
Comments
@AlexWaygood It seems to be a |
Sounds plausible, but I'm not much of a C programmer, so I'll let somebody else do the relabelling :) |
pythonGH-95355 Automerge-Triggered-By: GH:pablogsal (cherry picked from commit b946f52) Co-authored-by: Honglin Zhu <[email protected]>
pythonGH-95355 Automerge-Triggered-By: GH:pablogsal (cherry picked from commit b946f52) Co-authored-by: Honglin Zhu <[email protected]>
GH-95355 Automerge-Triggered-By: GH:pablogsal (cherry picked from commit b946f52) Co-authored-by: Honglin Zhu <[email protected]>
GH-95355 Automerge-Triggered-By: GH:pablogsal (cherry picked from commit b946f52) Co-authored-by: Honglin Zhu <[email protected]>
Ok done, it can indeed segfault if allocation fails, classic null dereference :) |
Fixed by #95356, thanks for the report! |
Bug report
I have questions when reading the source code of file
pegen.c
.There is a code snippet in function
_PyPegen_Parser_New
:I think it makes more sense to check
p->tokens[0]
but notp->tokens
in if condition.I look at the PR #19669 where the code was introduced and no one discussed this. Is this an oversight, or am I wrong?
Your environment
The text was updated successfully, but these errors were encountered: