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

FileIO.__init__ aborts when opener returns bad fd #82212

Closed
tekknolagi mannequin opened this issue Sep 4, 2019 · 4 comments
Closed

FileIO.__init__ aborts when opener returns bad fd #82212

tekknolagi mannequin opened this issue Sep 4, 2019 · 4 comments
Labels
3.10 only security fixes 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-IO type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@tekknolagi
Copy link
Mannequin

tekknolagi mannequin commented Sep 4, 2019

BPO 38031
Nosy @ZackerySpytz, @tekknolagi, @iritkatriel
PRs
  • bpo-38031: Fix a possible assertion failure in _io.FileIO() #15688
  • 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 = None
    created_at = <Date 2019-09-04.21:19:41.772>
    labels = ['interpreter-core', '3.9', 'expert-IO', '3.11', '3.10', 'type-crash']
    title = 'FileIO.__init__ aborts when opener returns bad fd'
    updated_at = <Date 2021-10-18.23:22:00.544>
    user = 'https://github.com/tekknolagi'

    bugs.python.org fields:

    activity = <Date 2021-10-18.23:22:00.544>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Interpreter Core', 'IO']
    creation = <Date 2019-09-04.21:19:41.772>
    creator = 'tekknolagi'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38031
    keywords = ['patch']
    message_count = 3.0
    messages = ['351150', '351159', '404246']
    nosy_count = 3.0
    nosy_names = ['ZackerySpytz', 'tekknolagi', 'iritkatriel']
    pr_nums = ['15688']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue38031'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @tekknolagi
    Copy link
    Mannequin Author

    tekknolagi mannequin commented Sep 4, 2019

    On a debug build, the following causes an abort:

    import _io
    _io.FileIO("foobar", opener=lambda name, flags: 1000000)

    1000000 is not a valid fd. FileIO attempts to raise an IOError from errno, but there is already an exception set when PyErr_SetFromErrno uses PyObject_Call to create the exception.

    @tekknolagi tekknolagi mannequin added topic-IO type-crash A hard crash of the interpreter, possibly with a core dump labels Sep 4, 2019
    @ZackerySpytz
    Copy link
    Mannequin

    ZackerySpytz mannequin commented Sep 5, 2019

    Thank you for the report.

    @ZackerySpytz ZackerySpytz mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes labels Sep 5, 2019
    @iritkatriel
    Copy link
    Member

    Reproduced on 3.11.

    @iritkatriel iritkatriel added 3.10 only security fixes 3.11 only security fixes and removed 3.7 (EOL) end of life 3.8 only security fixes labels Oct 18, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @iritkatriel iritkatriel removed the 3.9 only security fixes label Nov 25, 2022
    @iritkatriel
    Copy link
    Member

    #99775 is a backport of this pull request to the 3.11 branch.

    #99776 is a backport of this pull request to the 3.10 branch.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-IO type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant