Skip to content

FileIO.__init__ aborts when opener returns bad fd #82212

Closed

Description

@tekknolagi
mannequin
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']

    Activity

    1. tekknolagi commented on Sep 4, 2019

      tekknolagimannequin
      MannequinAuthor

      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.

    2. ZackerySpytz commented on Sep 5, 2019

      ZackerySpytzmannequin
      Mannequin

      Thank you for the report.

    3. iritkatriel commented on Oct 18, 2021

      @iritkatriel
      Member

      Reproduced on 3.11.

    4. added
      3.11only security fixes
      and removed on Oct 18, 2021
    5. transferred this issue fromon Apr 10, 2022
    6. iritkatriel commented on Nov 25, 2022

      @iritkatriel
      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

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of life3.11only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)topic-IOtype-crashA 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