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

[C++] Array::ToString() segfaults with null buffer.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.0.0
    • 6.0.0
    • C++

    Description

      In some tests in the Arrow test suite there are cases where arrays are made without allocating real buffers of data, using Buffer of length 0 and with nullptr as their data.

      In this cases the Array::ToString() does lead to segfault, at least for Int arrays.

      * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
          frame #0: 0x0000000101dac696 libarrow.500.dylib`std::__1::enable_if<is_integer_type<arrow::NumericArray<arrow::Int32Type>::TypeClass>::value, arrow::Status>::type arrow::ArrayPrinter::WriteDataValues<arrow::NumericArray<arrow::Int32Type> >(this=0x00007ffeefbfea98, i=0)::'lambda'(long long)::operator()(long long) const at pretty_print.cc:152:73
         149 	  enable_if_integer<typename T::TypeClass, Status> WriteDataValues(const T& array) {
         150 	    const auto data = array.raw_values();
         151 	    // Need to upcast integers to avoid selecting operator<<(char)
      -> 152 	    WriteValues(array, [&](int64_t i) { (*sink_) << internal::UpcastInt(data[i]); });
         153 	    return Status::OK();
         154 	  }
         155 	 
      

      The issue can probably be worked around by checking if the data in the array is valid (at least for the most obvious cases, like NULLS or 0-length data) when building the string representation

      Attachments

        Issue Links

          Activity

            People

              amol- Alessandro Molina
              amol- Alessandro Molina
              Votes:
              0 Vote for this issue
              Watchers:
              4 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 - 2h 10m
                  2h 10m