Describe the bug, including details regarding any error messages, version, and platform.
Describe the bug
Reading BYTE_ARRAY-backed Decimal32 values can trigger UBSan:
runtime error: store to misaligned address for type 'uint64_t'
The converter always writes two uint64_t values, even when the destination is Decimal32 (4 bytes) or Decimal64 (8 bytes):
|
auto out_ptr_view = reinterpret_cast<uint64_t*>(out_ptr); |
|
out_ptr_view[0] = 0; |
|
out_ptr_view[1] = 0; |
This became reachable for Decimal32/64 after GH-44345 / PR #47427.
The stores should be replaced with:
std::memset(out_ptr, 0, type_length);
The existing TestReadDecimals.Decimal32ByteArray test reproduces it when alignment sanitization is enabled.
Component(s)
C++, Parquet
Describe the bug, including details regarding any error messages, version, and platform.
Describe the bug
Reading BYTE_ARRAY-backed Decimal32 values can trigger UBSan:
The converter always writes two
uint64_tvalues, even when the destination is Decimal32 (4 bytes) or Decimal64 (8 bytes):arrow/cpp/src/parquet/arrow/reader_internal.cc
Lines 728 to 730 in d5eb88e
This became reachable for Decimal32/64 after GH-44345 / PR #47427.
The stores should be replaced with:
The existing
TestReadDecimals.Decimal32ByteArraytest reproduces it when alignment sanitization is enabled.Component(s)
C++, Parquet