Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-10193

[Python] Segfault when converting to fixed size binary array

Details

    Description

      Reproducer:

      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)
      

      Trace:

      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
      

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

      Attachments

        Issue Links

          Activity

            People

              kszucs Krisztian Szucs
              kszucs Krisztian Szucs
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m

                  Slack

                    Issue deployment