This is an automated email from the ASF dual-hosted git repository.
paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git
The following commit(s) were added to refs/heads/main by this push:
new 2778f739 fix: Read empty array test offsets at their native width
(#997)
2778f739 is described below
commit 2778f739ac747f1d7c077d07877705310591d059
Author: Dewey Dunnington <[email protected]>
AuthorDate: Sun Oct 25 22:14:35 2026 -0500
fix: Read empty array test offsets at their native width (#997)
The latest verify run
(https://github.com/apache/arrow-nanoarrow/actions/runs/40148573730)
fails on s390x because ArrayTestFinishBuildingEmptyArrayOffsets copies
four bytes into an int64_t initialized to -1, then truncates the
untouched low bytes on big-endian systems. Read each offset into an
integer of the matching width.
Reproduced all four failing assertions under QEMU s390x before the fix.
Afterward, the core CTest suite passes on s390x and native x86-64: 287
passed, three skipped on each. clang-format and git diff --check pass.
The full release verification workflow was not rerun.
---
src/nanoarrow/common/array_test.cc | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/nanoarrow/common/array_test.cc
b/src/nanoarrow/common/array_test.cc
index 9324cdde..31f44270 100644
--- a/src/nanoarrow/common/array_test.cc
+++ b/src/nanoarrow/common/array_test.cc
@@ -427,12 +427,15 @@ TEST(ArrayTest, ArrayTestFinishBuildingEmptyArrayOffsets)
{
<< error.message;
ASSERT_NE(array->buffers[1], nullptr);
EXPECT_EQ(ArrowArrayBuffer(array.get(), 1)->size_bytes,
test_case.offset_size);
- int64_t first_offset = -1;
- memcpy(&first_offset, array->buffers[1], test_case.offset_size);
if (test_case.offset_size == 4) {
- first_offset = static_cast<int32_t>(first_offset);
+ int32_t first_offset = -1;
+ memcpy(&first_offset, array->buffers[1], sizeof(first_offset));
+ EXPECT_EQ(first_offset, 0);
+ } else {
+ int64_t first_offset = -1;
+ memcpy(&first_offset, array->buffers[1], sizeof(first_offset));
+ EXPECT_EQ(first_offset, 0);
}
- EXPECT_EQ(first_offset, 0);
}
}