Skip to content
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

Segfault from new PEG parser handling yield withing f-strings #85081

Closed
stestagg mannequin opened this issue Jun 7, 2020 · 4 comments
Closed

Segfault from new PEG parser handling yield withing f-strings #85081

stestagg mannequin opened this issue Jun 7, 2020 · 4 comments
Labels
3.9 only security fixes 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@stestagg
Copy link
Mannequin

stestagg mannequin commented Jun 7, 2020

BPO 40904
Nosy @gvanrossum, @lysnikolaou, @pablogsal, @miss-islington, @stestagg
PRs
  • bpo-40904: Fix segfault in the new parser with f-string containing yield statements with no value #20701
  • [3.9] bpo-40904: Fix segfault in the new parser with f-string containing yield statements with no value (GH-20701) #20702
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-06-08.00:48:33.792>
    created_at = <Date 2020-06-07.23:06:21.114>
    labels = ['interpreter-core', '3.10', '3.9', 'type-crash']
    title = 'Segfault from new PEG parser handling yield withing f-strings'
    updated_at = <Date 2020-06-08.01:08:56.576>
    user = 'https://github.com/stestagg'

    bugs.python.org fields:

    activity = <Date 2020-06-08.01:08:56.576>
    actor = 'miss-islington'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-06-08.00:48:33.792>
    closer = 'pablogsal'
    components = ['Interpreter Core']
    creation = <Date 2020-06-07.23:06:21.114>
    creator = 'stestagg'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40904
    keywords = ['patch', '3.9regression']
    message_count = 4.0
    messages = ['370923', '370942', '370943', '370946']
    nosy_count = 5.0
    nosy_names = ['gvanrossum', 'lys.nikolaou', 'pablogsal', 'miss-islington', 'stestagg']
    pr_nums = ['20701', '20702']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue40904'
    versions = ['Python 3.9', 'Python 3.10']

    @stestagg
    Copy link
    Mannequin Author

    stestagg mannequin commented Jun 7, 2020

    The following command causes python to segfault:

    $ echo "f'{yield}'" | python/bin/python3

    Bisect tracked this down to:

    c5fc156 (bpo-40334: PEP-617 implementation: New PEG parser for CPython (GH-19503))

    The illegal access is coming out of fstring_shift_children_locations
    as n->v.Yield.value is None.

    Correspondingly, the following produces the expected output:

    $ echo "f'{yield 1}'" | python/bin/python3

    Suggesting there's a missing check for no yield value in this code.

    @stestagg stestagg mannequin added 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump labels Jun 7, 2020
    @vstinner vstinner added 3.9 only security fixes labels Jun 7, 2020
    @pablogsal
    Copy link
    Member

    New changeset 972ab03 by Pablo Galindo in branch 'master':
    bpo-40904: Fix segfault in the new parser with f-string containing yield statements with no value (GH-20701)
    972ab03

    @pablogsal
    Copy link
    Member

    Thanks, Steve for the report!

    @miss-islington
    Copy link
    Contributor

    New changeset 6440911 by Miss Islington (bot) in branch '3.9':
    bpo-40904: Fix segfault in the new parser with f-string containing yield statements with no value (GH-20701)
    6440911

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants