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 in command line processing due to buffer over-read #77887

Closed
cgohlke mannequin opened this issue May 31, 2018 · 4 comments
Closed

Segfault in command line processing due to buffer over-read #77887

cgohlke mannequin opened this issue May 31, 2018 · 4 comments
Labels
3.7 (EOL) end of life 3.8 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

@cgohlke
Copy link
Mannequin

cgohlke mannequin commented May 31, 2018

BPO 33706
Nosy @vstinner, @miss-islington
PRs
  • bpo-33706: Fix pymain_parse_cmdline_impl() #7283
  • [3.7] bpo-33706: Fix pymain_parse_cmdline_impl() (GH-7283) #7284
  • Files
  • master...cgohlke patch-1.diff
  • 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 2018-05-31.14:14:27.497>
    created_at = <Date 2018-05-31.06:31:10.545>
    labels = ['interpreter-core', '3.7', '3.8', 'type-crash']
    title = 'Segfault in command line processing due to buffer over-read'
    updated_at = <Date 2018-05-31.14:14:27.495>
    user = 'https://bugs.python.org/cgohlke'

    bugs.python.org fields:

    activity = <Date 2018-05-31.14:14:27.495>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-05-31.14:14:27.497>
    closer = 'vstinner'
    components = ['Interpreter Core']
    creation = <Date 2018-05-31.06:31:10.545>
    creator = 'cgohlke'
    dependencies = []
    files = ['47628']
    hgrepos = []
    issue_num = 33706
    keywords = ['patch']
    message_count = 4.0
    messages = ['318260', '318302', '318310', '318315']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'cgohlke', 'miss-islington']
    pr_nums = ['7283', '7284']
    priority = 'critical'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue33706'
    versions = ['Python 3.7', 'Python 3.8']

    @cgohlke
    Copy link
    Mannequin Author

    cgohlke mannequin commented May 31, 2018

    When testing Python 3.7.0b5 x64 (and betas before) on Windows 10, I occasionally get segfaults when passing a program as string on the command line. The shortest command to reproduce this on my system is python.exe -c 1 with heap detection turned on but that might not be reproducible on other systems.

    It turns out there is a buffer over-read when copying the PyOS_optarg string in main.c. The attached patch fixes the segfault on my system.

    @cgohlke cgohlke mannequin added 3.7 (EOL) end of life type-crash A hard crash of the interpreter, possibly with a core dump labels May 31, 2018
    @serhiy-storchaka serhiy-storchaka added interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.8 only security fixes labels May 31, 2018
    @vstinner
    Copy link
    Member

    New changeset 58d1683 by Victor Stinner in branch 'master':
    bpo-33706: Fix pymain_parse_cmdline_impl() (GH-7283)
    58d1683

    @miss-islington
    Copy link
    Contributor

    New changeset c6de46e by Miss Islington (bot) in branch '3.7':
    bpo-33706: Fix pymain_parse_cmdline_impl() (GH-7283)
    c6de46e

    @vstinner
    Copy link
    Member

    Thank you Christoph Gohlke for your bug report and your fix! I fixed 3.7 and master branches.

    @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.7 (EOL) end of life 3.8 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