Skip to content

[Python] flight wrappers and ParquetReader segfault when used without initialized native state #51230

Description

@marinelay

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

Summary

Several exposed flight wrapper classes and pyarrow.parquet.ParquetReader can be directly constructed without the native state expected by their methods and properties.
The operations listed below terminate the interpreter with SIGSEGV when used on those objects.
I grouped these cases because multiple operations across both groups fail in the same uninitialized object state.

I think unsupported direct construction or use before open() 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

Run each operation independently in a fresh process.

import pyarrow.flight as flight

flight.FlightMetadataReader().read()
flight.FlightStreamReader().read_all()
flight.MetadataRecordBatchReader().read_all()
flight.FlightStreamWriter().done_writing()
flight.MetadataRecordBatchWriter().close()
flight.FlightMetadataWriter().write(b"")
flight.ServerCallContext().peer()
import pyarrow.parquet as parquet

parquet.ParquetReader().read_all()
parquet.ParquetReader().read_column(0)
parquet.ParquetReader().read_row_group(0)
parquet.ParquetReader().scan_contents()
parquet.ParquetReader().column_name_idx("name")
parquet.ParquetReader().set_batch_size(1)
parquet.ParquetReader().set_use_threads(True)
parquet.ParquetReader().column_paths
parquet.ParquetReader().num_row_groups
parquet.ParquetReader().schema_arrow

Each listed operation was recorded as terminating with:

Segmentation fault (core dumped)

I found these cases while fuzzing Python C extension modules. If separate reports would be easier to track, I can split them by component.

Component(s)

Python

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions