Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cpp/src/arrow/tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ Status ValidateTensorParameters(const std::shared_ptr<DataType>& type,
std::vector<int64_t> tmp_strides;
RETURN_NOT_OK(ComputeRowMajorStrides(checked_cast<const FixedWidthType&>(*type),
shape, &tmp_strides));
RETURN_NOT_OK(CheckTensorStridesValidity(data, shape, tmp_strides, type));
}
if (dim_names.size() > shape.size()) {
return Status::Invalid("too many dim_names are supplied");
Expand Down
3 changes: 3 additions & 0 deletions cpp/src/arrow/tensor_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ TEST(TestTensor, MakeFailureCases) {
ASSERT_RAISES(Invalid, Tensor::Make(float64(), data, shape,
{sizeof(double) * 12, sizeof(double)}));

// row-major (implicit strides) shape larger than the backing buffer
ASSERT_RAISES(Invalid, Tensor::Make(float64(), data, {3, 100}));

// too many dim_names are supplied
ASSERT_RAISES(Invalid, Tensor::Make(float64(), data, shape, {}, {"foo", "bar", "baz"}));
}
Expand Down
Loading