Enforce input data is not object. (#6927)

* Check for object data type.
* Allow strided arrays with greater underlying buffer size.
This commit is contained in:
Jiaming Yuan
2021-05-02 00:09:01 +08:00
committed by GitHub
parent a1d23f6613
commit 37ad60fe25
4 changed files with 31 additions and 4 deletions

View File

@@ -229,8 +229,11 @@ class ArrayInterfaceHandler {
}
strides[1] = n;
}
auto valid = (rows - 1) * strides[0] + (cols - 1) * strides[1] == (rows * cols) - 1;
CHECK(valid) << "Invalid strides in array.";
auto valid = rows * strides[0] + cols * strides[1] >= (rows * cols);
CHECK(valid) << "Invalid strides in array."
<< " strides: (" << strides[0] << "," << strides[1]
<< "), shape: (" << rows << ", " << cols << ")";
}
static void* ExtractData(std::map<std::string, Json> const &column,