From e0cbe113745a38be7b3afa0dff63a819e4490005 Mon Sep 17 00:00:00 2001
From: lzk <liuzhongkai2@huawei.com>
Date: Fri, 21 May 2021 01:11:07 -0700
Subject: [PATCH] div 0 bug fix

---
 mindspore/lite/src/runtime/kernel/arm/base/split_base.cc | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mindspore/lite/src/runtime/kernel/arm/base/split_base.cc b/mindspore/lite/src/runtime/kernel/arm/base/split_base.cc
index 2448a407dd..b96e5aacb8 100644
--- a/mindspore/lite/src/runtime/kernel/arm/base/split_base.cc
+++ b/mindspore/lite/src/runtime/kernel/arm/base/split_base.cc
@@ -50,6 +50,15 @@ int SplitBaseCPUKernel::ReSize() {
     param->strides_[i] = param->strides_[i + 1] * input_shape.at(i + 1);
   }
 
+  if (input_shape.at(param->split_dim_) == 0) {
+    MS_LOG(ERROR) << "input_shape[" << param->split_dim_ << "] must not be zero!";
+    return RET_ERROR;
+  }
+  if (param->strides_[param->split_dim_] == 0) {
+    MS_LOG(ERROR) << "param->strides_[" << param->split_dim_ << "] must not be zero!";
+    return RET_ERROR;
+  }
+
   MS_ASSERT(static_cast<size_t>(param->split_dim_) < input_shape.size());
   param->split_count_ =
     param->strides_[0] * input_shape.at(0) / (input_shape.at(param->split_dim_) * param->strides_[param->split_dim_]);
-- 
2.17.1

