Skip to content

[Python] MemoryMappedFile().resize() segfaults when no file has been opened #51229

Closed

Description

@marinelay

Describe the bug, including details regarding any error messages, version, and platform.

Summary

MemoryMappedFile can be directly constructed without opening a file, and resize() on that object terminates the interpreter.
I found this while fuzzing Python C extension modules.
I think this unsupported state should raise a Python exception rather than terminate the process.

Versions

PyArrow 25.0.1, CPython 3.12.3, Debian 12 x86_64, glibc 2.36

Reproducer

import pyarrow as pa

pa.MemoryMappedFile().resize(0)
Segmentation fault (core dumped)

ASan/UBSan result

I built PyArrow 25.0.0 from source with Clang 18 using ASan and UBSan instrumentation.
UBSan reports a member call on a null arrow::io::MemoryMappedFile in the generated wrapper:

build/lib.cpp:252525:86: runtime error:
member call on null pointer of type 'arrow::io::MemoryMappedFile'

    #0 pyarrow.lib.MemoryMappedFile.resize(...)
       build/lib.cpp:252525:86

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
build/lib.cpp:252525:86

ASan then reports a read from address 0x28 on the same path.
The sanitizer process exits with code 134 after ASan aborts.

Component(s)

Python

Activity

  1. added a commit that references this issue on Sep 10, 2026
  2. AlenkaF commented on Sep 18, 2026

    @AlenkaF
    Member

    @1fanwang could you comment on the issue so I can assign it to you?

  3. AlenkaF commented on Sep 18, 2026

    @AlenkaF
    Member

    ps: you can also comment with take and the issue will automatically be assigned to you.

  4. 1fanwang commented on Sep 18, 2026

    @1fanwang
    Contributor

    take

  5. added a commit that references this issue on Sep 21, 2026
  6. added this to the 26.0.0 milestone on Sep 21, 2026
  7. AlenkaF commented on Sep 21, 2026

    @AlenkaF
    Member

    Issue resolved by pull request 51246
    #51246

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions