arrow icon indicating copy to clipboard operation
arrow copied to clipboard

[Python] Directly constructed FunctionOptions segfaults in serialize()

Open marinelay opened this issue 2 months ago • 5 comments

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

Summary

pyarrow.compute.FunctionOptions can be constructed without arguments, and calling serialize() on that object terminates the interpreter. I found this while fuzzing Python C extension modules. I realize the base class is probably not meant to be used directly, but I would expect a Python exception rather than a process crash.

Versions

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

Reproducer

import pyarrow.compute as pc

pc.FunctionOptions().serialize()
Segmentation fault (core dumped)

This is a different entry point from #51041, which covers FunctionOptions.deserialize() on non-Buffer arguments.

ASan/UBSan result

I built PyArrow 25.0.0 from source with Clang 18 using ASan and UBSan instrumentation. ASan reports a read from address 0x28 while the generated FunctionOptions.serialize() wrapper is adding its traceback:

AddressSanitizer:DEADLYSIGNAL
ERROR: AddressSanitizer: SEGV on unknown address 0x000000000028
The signal is caused by a READ memory access.
Hint: address points to the zero page.

    #0 PyException_GetTraceback
    #1 PyTraceBack_Here
    #2 __Pyx_AddTraceback(...)
       build/_compute.cpp:102581:5
    #3 pyarrow.compute.FunctionOptions.serialize(...)
       build/_compute.cpp:23014:3

SUMMARY: AddressSanitizer: SEGV in PyException_GetTraceback

The sanitizer process exits with code 1 after ASan aborts. UBSan does not emit a separate diagnostic before the ASan failure.

Component(s)

Python

marinelay avatar Sep 29 '26 07:09 marinelay

Hi @marinelay, I'd like to work on this issue. I can investigate the FunctionOptions().serialize() crash and work on making it raise a Python exception instead of terminating the interpreter. Would you be okay with assigning this issue to me?

aryan9948 avatar Sep 29 '26 14:09 aryan9948

@aryan9948 Sure

marinelay avatar Sep 29 '26 14:09 marinelay

@marinelay . So, Plz assigning this issue to me

aryan9948 avatar Sep 29 '26 14:09 aryan9948

@aryan9948 I don’t think I have permission to assign it, but maybe you can just comment “take” to claim it.

marinelay avatar Sep 29 '26 15:09 marinelay

@aryan9948 @marinelay we have removed the ability to self-assign issues to non collaborator users as we've had a lot of AI slop activity lately which obfuscates the real state of the issues. @aryan9948 I am going to assign the issue manually to you, feel free to create a PR but please as a new contributor read our AI guidelines.

raulcd avatar Sep 29 '26 15:09 raulcd