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

Invalid read in pegen.c #85057

Closed
skrah mannequin opened this issue Jun 5, 2020 · 3 comments
Closed

Invalid read in pegen.c #85057

skrah mannequin opened this issue Jun 5, 2020 · 3 comments
Labels
3.9 only security fixes 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@skrah
Copy link
Mannequin

skrah mannequin commented Jun 5, 2020

BPO 40880
Nosy @gvanrossum, @skrah, @lysnikolaou, @pablogsal, @miss-islington
PRs
  • bpo-40880: Fix invalid read in newline_in_string in pegen.c #20666
  • [3.9] bpo-40880: Fix invalid read in newline_in_string in pegen.c (GH-20666) #20670
  • 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-06.00:44:47.735>
    created_at = <Date 2020-06-05.22:00:14.822>
    labels = ['interpreter-core', 'type-bug', '3.9', '3.10']
    title = 'Invalid read in pegen.c'
    updated_at = <Date 2020-06-06.00:44:47.734>
    user = 'https://github.com/skrah'

    bugs.python.org fields:

    activity = <Date 2020-06-06.00:44:47.734>
    actor = 'pablogsal'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-06-06.00:44:47.735>
    closer = 'pablogsal'
    components = ['Interpreter Core']
    creation = <Date 2020-06-05.22:00:14.822>
    creator = 'skrah'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40880
    keywords = ['patch']
    message_count = 3.0
    messages = ['370791', '370798', '370801']
    nosy_count = 5.0
    nosy_names = ['gvanrossum', 'skrah', 'lys.nikolaou', 'pablogsal', 'miss-islington']
    pr_nums = ['20666', '20670']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue40880'
    versions = ['Python 3.9', 'Python 3.10']

    @skrah
    Copy link
    Mannequin Author

    skrah mannequin commented Jun 5, 2020

    From test_decimal:

    test_xor (test.test_decimal.PyIBMTestCases) ... ==17597== Invalid read of size 1
    ==17597== at 0x64A7E2: newline_in_string (pegen.c:940)
    ==17597== by 0x64A84E: bad_single_statement (pegen.c:958)
    ==17597== by 0x64AD59: _PyPegen_run_parser (pegen.c:1101)
    ==17597== by 0x64B044: _PyPegen_run_parser_from_string (pegen.c:1194)
    ==17597== by 0x5C6D56: PyPegen_ASTFromStringObject (peg_api.c:27)
    ==17597== by 0x52A2A9: Py_CompileStringObject (pythonrun.c:1259)
    ==17597== by 0x63CBF6: builtin_compile_impl (bltinmodule.c:819)
    ==17597== by 0x63AF08: builtin_compile (bltinmodule.c.h:249)
    ==17597== by 0x5F9446: cfunction_vectorcall_FASTCALL_KEYWORDS (methodobject.c:440)
    ==17597== by 0x4D2642: _PyObject_VectorcallTstate (abstract.h:114)
    ==17597== by 0x4D26A1: PyObject_Vectorcall (abstract.h:123)
    ==17597== by 0x4E3F26: call_function (ceval.c:5111)
    ==17597== Address 0xadc82bf is 1 bytes before a block of size 22 alloc'd
    ==17597== at 0x4C3016F: realloc (vg_replace_malloc.c:826)
    ==17597== by 0x46A983: _PyMem_RawRealloc (obmalloc.c:121)
    ==17597== by 0x46B49E: PyMem_Realloc (obmalloc.c:623)
    ==17597== by 0x5C9565: translate_newlines (tokenizer.c:654)
    ==17597== by 0x5C98FE: PyTokenizer_FromUTF8 (tokenizer.c:751)
    ==17597== by 0x64AF7F: _PyPegen_run_parser_from_string (pegen.c:1169)
    ==17597== by 0x5C6D56: PyPegen_ASTFromStringObject (peg_api.c:27)
    ==17597== by 0x52A2A9: Py_CompileStringObject (pythonrun.c:1259)
    ==17597== by 0x63CBF6: builtin_compile_impl (bltinmodule.c:819)
    ==17597== by 0x63AF08: builtin_compile (bltinmodule.c.h:249)
    ==17597== by 0x5F9446: cfunction_vectorcall_FASTCALL_KEYWORDS (methodobject.c:440)
    ==17597== by 0x4D2642: _PyObject_VectorcallTstate (abstract.h:114)
    ==17597==

    *--cur dereferences one below p->tok->buf in the last iteration.

    @skrah skrah mannequin added 3.9 only security fixes 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Jun 5, 2020
    @pablogsal
    Copy link
    Member

    New changeset 2e6593d by Pablo Galindo in branch 'master':
    bpo-40880: Fix invalid read in newline_in_string in pegen.c (bpo-20666)
    2e6593d

    @miss-islington
    Copy link
    Contributor

    New changeset 15fec56 by Miss Islington (bot) in branch '3.9':
    bpo-40880: Fix invalid read in newline_in_string in pegen.c (GH-20666)
    15fec56

    @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-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants