Repository navigation
Check tokens[0] after allocating memory #95355
Copy link
Copy link
Closed
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixestype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jul 28, 2022 - added a commit that references this issue
on Jul 28, 2022 @AlexWaygood It seems to be a
type-crashsincePyMem_Calloc()failure is ignored leading to a C null pointer access somewhere below.@AlexWaygood It seems to be a
type-crashsincePyMem_Calloc()failure is ignored leading to a C null pointer access somewhere below.Sounds plausible, but I'm not much of a C programmer, so I'll let somebody else do the relabelling :)
- added 4 commits that reference this issue
on Jul 28, 2022 - added3.11only security fixesonly security fixes3.10 (EOL)end of lifeend of life3.12only security fixesonly security fixestype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
on Jul 28, 2022 Sounds plausible, but I'm not much of a C programmer, so I'll let somebody else do the relabelling :)
Ok done, it can indeed segfault if allocation fails, classic null dereference :)
Reacted by Alex WaygoodFixed by #95356, thanks for the report!
Reacted by Alex Waygood, Honglin Zhu and Oleg Iarygin- removedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jul 28, 2022
Metadata
Metadata
Assignees
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixestype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
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->tokensin 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