GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Some object-to-AST conversions are missing error checks · Issue #105588 · python/cpython

Some object-to-AST conversions are missing error checks #105588

New issue
Copy link
New issue
Copy link
Closed
Closed
Some object-to-AST conversions are missing error checks#105588
Copy link
Assignees
brandtbucher
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)triagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

Description

@brandtbucher
brandtbucher
opened on Jun 9, 2023
Issue body actions

The generated code in Python-ast.c is missing error checks following the construction of C-level alias, arg, comprehension, keyword, match_item, and withitem nodes from their Python object counterparts. This means it's possible to crash the interpreter by attempting to compile an AST where a required member of these nodes is replaced with None:

>>> import ast
>>> tree = ast.parse("""
... match ...:
...     case THIS:
...         ...
... """)
>>> tree.body[0].cases[0].pattern = None
>>> compile(tree, "<crash>", "exec")
Segmentation fault

I'll have a PR up in a minute with the one-line fix.

Linked PRs

  • GH-105588: Add missing error checks to some obj2ast_* converters #105589
  • [3.12] GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589) #105838
  • [3.11] GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589) #105839

Activity

  1. brandtbucher
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    3.11only security fixesonly security fixes
    type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
    3.12only security fixesonly security fixes
    triagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.
    3.13only security fixesonly security fixes
    on Jun 9, 2023
  2. brandtbucher
    self-assigned this
    on Jun 9, 2023
  3. brandtbucher
    added a commit that references this issue on Jun 15, 2023

    GH-105588: Add missing error checks to some obj2ast_* converters (GH-…

    a4056c8
  4. miss-islington
    added 2 commits that reference this issue on Jun 15, 2023

    pythonGH-105588: Add missing error checks to some obj2ast_* converters (

    f8c3966

    pythonGH-105588: Add missing error checks to some obj2ast_* converters (

    3680071
  5. brandtbucher
    closed this as completedon Jun 15, 2023
  6. brandtbucher
    added 2 commits that reference this issue on Jun 15, 2023

    [3.12] GH-105588: Add missing error checks to some obj2ast_* converte…

    0add516

    [3.11] GH-105588: Add missing error checks to some obj2ast_* converte…

    c0c4186
  7. carljm
    added a commit that references this issue on Jun 16, 2023

    Merge branch 'main' into modulelocals

    b096651
  8. gvanrossum
    added a commit that references this issue on Jun 18, 2023

    pythonGH-105588: Add missing error checks to some obj2ast_* converters (

    524490c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @brandtbucher
    brandtbucher

Labels

3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)triagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.type-crashA hard crash of the interpreter, possibly with a core dumpA 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

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.