Skip to content

Commit 900b98d

Browse files
committed
Remove invalid test causing segfaults with empty tensors
The TEST(TestSparseCSFIndex, EqualsMismatchedDimensions) test created SparseCSFIndex objects with empty tensors (nullptr buffers, 0-length shape), causing segfaults during validation on ASAN/UBSAN and 'front() called on empty vector' errors on MSVC. The typed test TestEqualityMismatchedDimensions already properly validates the fix with valid CSF index structures.
1 parent 8dbc21b commit 900b98d

1 file changed

Lines changed: 0 additions & 25 deletions

File tree

cpp/src/arrow/sparse_tensor_test.cc

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,29 +1697,4 @@ TEST(TestSparseCSFMatrixForUInt64Index, Make) {
16971697
ASSERT_RAISES(Invalid, SparseCSFTensor::Make(dense_tensor, uint64()));
16981698
}
16991699

1700-
TEST(TestSparseCSFIndex, EqualsMismatchedDimensions) {
1701-
std::vector<int64_t> axis_order_4d = {0, 1, 2, 3};
1702-
std::vector<int64_t> axis_order_2d = {0, 1};
1703-
1704-
// Create empty tensors for indptr/indices
1705-
auto empty_buffer = std::make_shared<Buffer>(nullptr, 0);
1706-
auto tensor_4d = std::make_shared<Tensor>(int32(), empty_buffer, std::vector<int64_t>{0});
1707-
auto tensor_2d = std::make_shared<Tensor>(int32(), empty_buffer, std::vector<int64_t>{0});
1708-
1709-
// Create a 4D index
1710-
std::vector<std::shared_ptr<Tensor>> indptr_4d = {tensor_4d, tensor_4d, tensor_4d};
1711-
std::vector<std::shared_ptr<Tensor>> indices_4d = {tensor_4d, tensor_4d, tensor_4d, tensor_4d};
1712-
auto si_4d = std::make_shared<SparseCSFIndex>(indptr_4d, indices_4d, axis_order_4d);
1713-
1714-
// Create a 2D index
1715-
std::vector<std::shared_ptr<Tensor>> indptr_2d = {tensor_2d};
1716-
std::vector<std::shared_ptr<Tensor>> indices_2d = {tensor_2d, tensor_2d};
1717-
auto si_2d = std::make_shared<SparseCSFIndex>(indptr_2d, indices_2d, axis_order_2d);
1718-
1719-
// Before fix: This would segfault.
1720-
// After fix: Returns false safely.
1721-
ASSERT_FALSE(si_4d->Equals(*si_2d));
1722-
ASSERT_FALSE(si_2d->Equals(*si_4d));
1723-
}
1724-
17251700
} // namespace arrow

0 commit comments

Comments
 (0)