Skip to content

Commit

Permalink
Fix ubsan issue on memory alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurpassos authored and Enmk committed Jan 21, 2025
1 parent 39d79f7 commit 3225fe4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Processors/Formats/Impl/Parquet/ParquetDataBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@ class ParquetDataBuffer
auto necessary_bytes = count * sizeof(ParquetType);
checkAvaible(necessary_bytes);

const ParquetType* src = reinterpret_cast<const ParquetType*>(data);

for (std::size_t i = 0; i < count; i++)
{
dst[i] = static_cast<TValue>(src[i]);
auto offset = i * sizeof(ParquetType);
dst[i] = unalignedLoad<TValue>(data + offset);
}

consume(necessary_bytes);
Expand Down

0 comments on commit 3225fe4

Please sign in to comment.