Skip to content

Commit e2275a1

Browse files
committed
Fix ALP vector metadata bounds on 32-bit targets
kStoredSize is int64_t, so subtracting it from a size_t yields int64_t wherever size_t is 32 bits. Inside the span's braced initializer that is a narrowing conversion, which broke the i386 and Emscripten builds.
1 parent 2fb0c5f commit e2275a1

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎cpp/src/arrow/util/alp/alp_codec.cc‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,10 @@ Result<typename AlpVectorReader<T>::VectorLayout> AlpVectorReader<T>::LoadVector
399399

400400
VectorLayout layout;
401401
ARROW_ASSIGN_OR_RAISE(layout.alp_info, AlpInfo::Load({vector_start, remaining_bytes}));
402-
ARROW_ASSIGN_OR_RAISE(layout.for_info,
403-
AlpForInfo<T>::Load({vector_start + AlpInfo::kStoredSize,
404-
remaining_bytes - AlpInfo::kStoredSize}));
402+
ARROW_ASSIGN_OR_RAISE(
403+
layout.for_info,
404+
AlpForInfo<T>::Load({vector_start + AlpInfo::kStoredSize,
405+
remaining_bytes - static_cast<size_t>(AlpInfo::kStoredSize)}));
405406

406407
ARROW_ASSIGN_OR_RAISE(layout.num_elements, VectorLength(vector_index));
407408
layout.data = vector_start + kMetadataSize;

0 commit comments

Comments
 (0)