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

assertion failure in zipimporter.get_source() in case of a bad zlib.decompress() #75783

Closed
orenmn mannequin opened this issue Sep 27, 2017 · 2 comments
Closed

assertion failure in zipimporter.get_source() in case of a bad zlib.decompress() #75783

orenmn mannequin opened this issue Sep 27, 2017 · 2 comments
Assignees
Labels
3.7 (EOL) end of life extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@orenmn
Copy link
Mannequin

orenmn mannequin commented Sep 27, 2017

BPO 31602
Nosy @brettcannon, @orenmn
PRs
  • bpo-31602: Fix an assertion failure in zipimporter.get_source() in case of a bad zlib.decompress() #3784
  • 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 = 'https://github.com/brettcannon'
    closed_at = <Date 2017-09-29.18:35:09.294>
    created_at = <Date 2017-09-27.06:24:51.408>
    labels = ['extension-modules', '3.7', 'type-crash']
    title = 'assertion failure in zipimporter.get_source() in case of a bad zlib.decompress()'
    updated_at = <Date 2017-09-29.18:35:09.293>
    user = 'https://github.com/orenmn'

    bugs.python.org fields:

    activity = <Date 2017-09-29.18:35:09.293>
    actor = 'brett.cannon'
    assignee = 'brett.cannon'
    closed = True
    closed_date = <Date 2017-09-29.18:35:09.294>
    closer = 'brett.cannon'
    components = ['Extension Modules']
    creation = <Date 2017-09-27.06:24:51.408>
    creator = 'Oren Milman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31602
    keywords = ['patch']
    message_count = 2.0
    messages = ['303100', '303351']
    nosy_count = 2.0
    nosy_names = ['brett.cannon', 'Oren Milman']
    pr_nums = ['3784']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue31602'
    versions = ['Python 3.7']

    @orenmn
    Copy link
    Mannequin Author

    orenmn mannequin commented Sep 27, 2017

    The following code causes an assertion failure (in case there exists a
    compressed zip file named 'foo.zip' with a file called 'bar.py' in it):

    import zlib
    import zipimport
    def bad_decompress(*args):
        return None
    
    zlib.decompress = bad_decompress
    zipimport.zipimporter('foo.zip').get_source('bar')

    This is because get_data() (in Modules/zipimport.c) assumes that
    zlib.decompress() returned a bytes object, and returns it.
    zipimport_zipimporter_get_source_impl() assumes that get_data() returned a
    bytes object, and passes it to PyBytes_AS_STRING(), which asserts it is a bytes
    object.

    @orenmn orenmn mannequin added 3.7 (EOL) end of life extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump labels Sep 27, 2017
    @brettcannon brettcannon self-assigned this Sep 29, 2017
    @brettcannon
    Copy link
    Member

    New changeset 01c6a88 by Brett Cannon (Oren Milman) in branch 'master':
    bpo-31602: Fix an assertion failure in zipimporter.get_source() in case of a bad zlib.decompress() (GH-3784)
    01c6a88

    @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 extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant