Skip to content

Commit 40f384d

Browse files
authored
Merge pull request #687 from Altinity/backports/24.8/74534_fix_ubsan_error_in_parquetdatabuffer
24.8 Backport of ClickHouse#74534 - Fix UBSan error in ParquetDataBuffer
2 parents bfafe3d + 1244161 commit 40f384d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Processors/Formats/Impl/Parquet/ParquetDataBuffer.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ class ParquetDataBuffer
5454
auto necessary_bytes = count * sizeof(ParquetType);
5555
checkAvaible(necessary_bytes);
5656

57-
const ParquetType* src = reinterpret_cast<const ParquetType*>(data);
58-
5957
for (std::size_t i = 0; i < count; i++)
6058
{
61-
dst[i] = static_cast<TValue>(src[i]);
59+
auto offset = i * sizeof(ParquetType);
60+
dst[i] = unalignedLoad<TValue>(data + offset);
6261
}
6362

6463
consume(necessary_bytes);

0 commit comments

Comments
 (0)