marinelay opened a new issue, #51019:
URL: https://github.com/apache/arrow/issues/51019

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   ### Summary
   
   `KeyValueMetadata.key(0)` and `KeyValueMetadata.value(0)` cause a 
segmentation fault when called on an empty `KeyValueMetadata` object.
   
   ### Versions
   
   pyarrow 25.0.0, CPython 3.12.3, Ubuntu 24.04 x86_64, glibc 2.39.
   
   ### Reproducer
   
   Each call below reproduces independently.
   
   ```python
   import pyarrow as pa
   pa.KeyValueMetadata().key(0)
   ```
   
   ```python
   import pyarrow as pa
   pa.KeyValueMetadata().value(0)
   ```
   
   Running either call produces:
   
   ```console
   Segmentation fault (core dumped)
   ```
   
   An UBSan source build reports an out-of-range 
`std::vector<std::string>::operator[]` access from 
`src/arrow/util/key_value_metadata.cc:169` or `:175`.
   
   ---
   
   This was found while fuzzing Python C extension modules for a small research 
project.
   It looks like a bug to me, but I would appreciate a check.
   I would expect `IndexError` rather than an unchecked native vector access.
   
   ### Component(s)
   
   Python


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to