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

mmap crashes just on boundary. #49542

Closed
ocean-city mannequin opened this issue Feb 17, 2009 · 3 comments
Closed

mmap crashes just on boundary. #49542

ocean-city mannequin opened this issue Feb 17, 2009 · 3 comments
Labels
extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@ocean-city
Copy link
Mannequin

ocean-city mannequin commented Feb 17, 2009

BPO 5292
Files
  • fix_segfault_on_boundary.patch
  • 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 2009-02-17.10:13:42.160>
    created_at = <Date 2009-02-17.09:35:55.773>
    labels = ['extension-modules', 'type-crash']
    title = 'mmap crashes just on boundary.'
    updated_at = <Date 2009-02-17.10:13:42.158>
    user = 'https://bugs.python.org/ocean-city'

    bugs.python.org fields:

    activity = <Date 2009-02-17.10:13:42.158>
    actor = 'ocean-city'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-02-17.10:13:42.160>
    closer = 'ocean-city'
    components = ['Extension Modules']
    creation = <Date 2009-02-17.09:35:55.773>
    creator = 'ocean-city'
    dependencies = []
    files = ['13115']
    hgrepos = []
    issue_num = 5292
    keywords = ['patch']
    message_count = 3.0
    messages = ['82307', '82308', '82314']
    nosy_count = 1.0
    nosy_names = ['ocean-city']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue5292'
    versions = ['Python 2.6', 'Python 3.0', 'Python 3.1', 'Python 2.7']

    @ocean-city
    Copy link
    Mannequin Author

    ocean-city mannequin commented Feb 17, 2009

    I noticed following code crashes. I'll post fix soon.

    import mmap
    import os
    
    def main():
    	align = mmap.ALLOCATIONGRANULARITY
    	path = os.path.splitext(__file__)[0] + ".txt"
    	with open(path, "w") as f:
    		f.write("0" * align)
    		f.write("1" * align)
    		f.write("2" * align)
    	with open(path, "r+") as f:
    		m = mmap.mmap(f.fileno(), align)
    	m[align] # crash
            m[align] = '1' # crash too
    
    if __name__ == '__main__':
    	main()

    @ocean-city ocean-city mannequin added extension-modules C modules in the Modules dir type-crash A hard crash of the interpreter, possibly with a core dump labels Feb 17, 2009
    @ocean-city
    Copy link
    Mannequin Author

    ocean-city mannequin commented Feb 17, 2009

    Here is a patch.

    @ocean-city
    Copy link
    Mannequin Author

    ocean-city mannequin commented Feb 17, 2009

    This is obvious bug (and fix is obvious too), so I've commited in r69714.

    @ocean-city ocean-city mannequin closed this as completed Feb 17, 2009
    @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
    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

    0 participants