Krisztian Szucs created ARROW-10193:
---------------------------------------

             Summary: [Python] Segfault when converting to fixed size binary 
array
                 Key: ARROW-10193
                 URL: https://issues.apache.org/jira/browse/ARROW-10193
             Project: Apache Arrow
          Issue Type: Bug
          Components: Python
            Reporter: Krisztian Szucs
            Assignee: Krisztian Szucs
             Fix For: 2.0.0


Reproducer:
{code:python}
 data = [b'\x19h\r\x9e\x00\x00\x00\x00\x01\x9b\x9fA']
    assert len(data[0]) == 12
    ty = pa.binary(12)
    arr = pa.array(data, type=ty)
{code}

Trace:
{code}
pyarrow/tests/test_convert_builtin.py::test_fixed_size_binary_length_check 
../src/arrow/array/builder_binary.cc:53:  Check failed: (size) == (byte_width_) 
Appending wrong size to FixedSizeBinaryBuilder
0   libarrow.200.0.0.dylib              0x000000010e7f9704 
_ZN5arrow4util7CerrLog14PrintBackTraceEv + 52
1   libarrow.200.0.0.dylib              0x000000010e7f9622 
_ZN5arrow4util7CerrLogD2Ev + 98
2   libarrow.200.0.0.dylib              0x000000010e7f9585 
_ZN5arrow4util7CerrLogD1Ev + 21
3   libarrow.200.0.0.dylib              0x000000010e7f95ac 
_ZN5arrow4util7CerrLogD0Ev + 28
4   libarrow.200.0.0.dylib              0x000000010e7f9492 
_ZN5arrow4util8ArrowLogD2Ev + 82
5   libarrow.200.0.0.dylib              0x000000010e7f94c5 
_ZN5arrow4util8ArrowLogD1Ev + 21
6   libarrow.200.0.0.dylib              0x000000010e303ec1 
_ZN5arrow22FixedSizeBinaryBuilder14CheckValueSizeEx + 209
7   libarrow.200.0.0.dylib              0x000000010e30c361 
_ZN5arrow22FixedSizeBinaryBuilder12UnsafeAppendEN6nonstd7sv_lite17basic_string_viewIcNSt3__111char_traitsIcEEEE
 + 49
8   libarrow_python.200.0.0.dylib       0x000000010b4efa7d 
_ZN5arrow2py20PyPrimitiveConverterINS_19FixedSizeBinaryTypeEvE6AppendEP7_object 
+ 813
{code}

The input {{const char*}} value gets implicitly casted to string_view which 
makes the length check fail in debug builds.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to