!30457 [MS][LITE] fix fuzz bug

Merge pull request !30457 from jianghui58/codex_fuzz_master
This commit is contained in:
i-robot 2022-02-24 10:53:00 +00:00 committed by Gitee
commit eab84bb7fb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 9 additions and 2 deletions

View File

@ -54,6 +54,8 @@ int Deconv2dInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC
int kernel_w = param->kernel_w_ != -1 ? param->kernel_w_ : GetWidth(weight);
int kernel_h = param->kernel_h_ != -1 ? param->kernel_h_ : GetHeight(weight);
MS_CHECK_FALSE(kernel_w <= 0, NNACL_ERR);
MS_CHECK_FALSE(kernel_h <= 0, NNACL_ERR);
MS_CHECK_FALSE(INT_MUL_OVERFLOW(kernel_h, kernel_w), NNACL_ERR);
int stride_w = param->stride_w_;

View File

@ -28,8 +28,12 @@ int SetPadAndAct(schema::PadMode pad_mode, schema::ActivationType act_type, Conv
case schema::PadMode_VALID:
param->pad_mode_ = Pad_valid;
break;
default:
case schema::PadMode_PAD:
param->pad_mode_ = Pad_pad;
break;
default:
MS_LOG(ERROR) << "pad mode does not support, " << pad_mode;
return RET_NOT_SUPPORT;
}
switch (act_type) {

View File

@ -89,7 +89,7 @@ int GatherNdCPUKernel::InitOffset() {
return RET_ERROR;
}
auto indices_ptr = reinterpret_cast<int *>(indices_tensor->data());
MS_ASSERT(indices_ptr != nullptr);
MS_CHECK_TRUE_MSG(indices_ptr != nullptr, RET_ERROR, "indices_ptr is nullptr.");
area_ = 1;
for (int i = idx_lastshape; i < in_rank; ++i) {
area_ *= in_shape[i];

View File

@ -227,6 +227,7 @@ std::vector<Tensor *> ConvertTensorToLiteTensor(const MetaGraphT *graph, const s
ConvertTensorList(graph, tensor_index, &convert_succ, &lite_tensors);
break;
case kObjectTypeString:
MS_CHECK_TRUE_MSG(tensorT->dims.size() <= 1, {}, "String type tensor dims should be less than or equal to 1.");
ConvertString(graph, tensor_index, &convert_succ, &lite_tensors);
break;
default: