Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Check tokens[0] after allocating memory #95355

Closed
Labels
3.10only security fixes3.11only security fixes3.12only security fixestype-crashA hard crash of the interpreter, possibly with a core dump
@imzhuhl

Description

@imzhuhl

Bug report

I have questions when reading the source code of filepegen.c.
There is a code snippet in function_PyPegen_Parser_New:

p->tokens[0]=PyMem_Calloc(1,sizeof(Token));if (!p->tokens) {PyMem_Free(p->tokens);PyMem_Free(p);return (Parser*)PyErr_NoMemory();}

I think it makes more sense to checkp->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

  • CPython versions tested on: main branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10only security fixes3.11only security fixes3.12only security fixestype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp