[Python] `call_tabular_function()` segfaults for some wrong typed `func_registry` values
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Bắt đầu tại pyarrow/src/arrow/python/udf.cc:655 trong CallTabularFunction() và tái hiện lỗi crash bằng lệnh gọi Python được cung cấp, sử dụng các giá trị func_registry sai kiểu đã liệt kê. Chạy trình tái hiện bằng UBSan hoặc wheel bị ảnh hưởng và xác minh rằng các đầu vào không phải là FunctionRegistry luôn phát sinh TypeError mà không kết thúc trình thông dịch.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug, including details regarding any error messages, version, and platform.
Summary
The behavior of pyarrow.compute.call_tabular_function() depends on the value supplied as a wrong typed func_registry.
Some values, including 0.0, 1, and -1, terminate the interpreter with SIGSEGV.
Most other tested wrong type values do not crash and instead reach the normal missing function ArrowKeyError path.
I think all non-FunctionRegistry values should be handled consistently without terminating the process, preferably by raising TypeError.
I found this while fuzzing Python C extension modules.
Versions
PyArrow 25.0.0, CPython 3.12.3, Ubuntu 24.04 x86_64, glibc 2.39.
Reproducer
import pyarrow.compute as pc
pc.call_tabular_function("", None, 0.0)
Segmentation fault (core dumped)
Input validation behavior
I kept the function name and args=None unchanged and independently varied only func_registry on the same binary wheel.
| Result | Tested func_registry values |
|---|---|
| SIGSEGV | True, 1, -1, 0.0, 1j, dict |
ArrowKeyError from the missing function name |
None, False, 0, inf, nan, 0j, str, bytes, bytearray, list, tuple, set,object() |
ASan/UBSan result
An earlier instrumented variant using the same wrong-typed registry path reported a misaligned member call in CallTabularFunction():
pyarrow/src/arrow/python/udf.cc:655:3: runtime error:
member call on misaligned address 0x00010c3298eb
for type 'arrow::compute::FunctionRegistry', which requires 8 byte alignment
#0 arrow::py::CallTabularFunction(...)
pyarrow/src/arrow/python/udf.cc:655:3
#1 pyarrow._compute.call_tabular_function(...)
build/_compute.cpp:70892:92
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
pyarrow/src/arrow/python/udf.cc:655:3
The sanitizer process exits with code 1 at the first UBSan diagnostic.
ASan does not emit a separate diagnostic when UBSan is configured to stop at that first error.
Component(s)
Python
- Ngôn ngữ chính
- C++
- Star
- 17.1k
- Fork
- 4.3k
- Merge trung bình
- 3 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 93
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/arrow
-
Component: Continuous Integration Component: MATLAB Type: enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Component: C++ Component: Parquet Type: enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Component: C++ Component: Parquet
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Component: C++ Type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Component: Archery Component: Continuous Integration Component: Developer Tools Type: enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
AXERA-TECH/ax-llm#77 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
games-on-whales/wolf#509 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
bug-unconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
NVIDIA/cuda-samples#453 ·