|
|
|
@@ -37,24 +37,28 @@ OpParameter *PopulateStridedSliceParameter(const mindspore::lite::PrimitiveC *pr |
|
|
|
auto begin = ((lite::StridedSlice *)primitive)->GetBegins(); |
|
|
|
if (begin.size() > std::numeric_limits<size_t>::max() / sizeof(int)) { |
|
|
|
MS_LOG(ERROR) << "The value of begin.size() is too big"; |
|
|
|
free(strided_slice_param); |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
memcpy(strided_slice_param->begins_, (begin.data()), begin.size() * sizeof(int)); |
|
|
|
auto end = ((lite::StridedSlice *)primitive)->GetEnds(); |
|
|
|
if (end.size() > std::numeric_limits<size_t>::max() / sizeof(int)) { |
|
|
|
MS_LOG(ERROR) << "The value of end.size() is too big"; |
|
|
|
free(strided_slice_param); |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
memcpy(strided_slice_param->ends_, (end.data()), end.size() * sizeof(int)); |
|
|
|
auto stride = ((lite::StridedSlice *)primitive)->GetStrides(); |
|
|
|
if (stride.size() > std::numeric_limits<size_t>::max() / sizeof(int)) { |
|
|
|
MS_LOG(ERROR) << "The value of stride.size() is too big"; |
|
|
|
free(strided_slice_param); |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
memcpy(strided_slice_param->strides_, (stride.data()), stride.size() * sizeof(int)); |
|
|
|
auto in_shape = ((lite::StridedSlice *)primitive)->GetInShape(); |
|
|
|
if (in_shape.size() > std::numeric_limits<size_t>::max() / sizeof(int)) { |
|
|
|
MS_LOG(ERROR) << "The value of in_shape.size() is too big"; |
|
|
|
free(strided_slice_param); |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
memcpy(strided_slice_param->in_shape_, (in_shape.data()), in_shape.size() * sizeof(int)); |
|
|
|
|