!29307 [MSLITE][CPU] fuzz test problem bugfix, fix arithmetic_self op checkspec

Merge pull request !29307 from Greatpan/fuzz_problem
This commit is contained in:
i-robot 2022-01-20 11:21:45 +00:00 committed by Gitee
commit 764c70671f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 15 additions and 2 deletions

View File

@ -61,9 +61,18 @@
} \
} while (0)
#define CHECK_NOT_EQUAL_RETURN(size1, size2) \
do { \
if ((size1) != (size2)) { \
MS_LOG(ERROR) << #size1 << " must be equal to " << #size2; \
return mindspore::lite::RET_ERROR; \
} \
} while (0)
#else
#define CHECK_NULL_RETURN(ptr)
#define CHECK_NULL_RETURN_VOID(ptr)
#define CHECK_LESS_RETURN(size1, size2)
#define CHECK_NOT_EQUAL_RETURN(size1, size2)
#endif
#endif // MINDSPORE_LITE_SRC_COMMON_LOG_UTIL_H_

View File

@ -60,8 +60,8 @@ ArithmeticSelfBoolFunc ArithmeticSelfCPUKernel::GetArithmeticSelfBoolFun(int pri
}
int ArithmeticSelfCPUKernel::Prepare() {
CHECK_LESS_RETURN(in_tensors_.size(), 1);
CHECK_LESS_RETURN(out_tensors_.size(), 1);
CHECK_NOT_EQUAL_RETURN(in_tensors_.size(), 1);
CHECK_NOT_EQUAL_RETURN(out_tensors_.size(), 1);
if (!InferShapeDone()) {
return RET_OK;
}

View File

@ -148,6 +148,10 @@ int CopyConstTensorData(const std::vector<Tensor *> &tensors, int op_type) {
}
for (auto *tensor : tensors) {
// only copy non-copied const tensor
if (!tensor->IsConst() && tensor->data() != nullptr) {
MS_LOG(ERROR) << "Illegitimate tensor : " << tensor->tensor_name();
continue;
}
if (!tensor->IsConst() || tensor->own_data()) {
continue;
}