diff --git a/mindspore/lite/src/weight_decoder.h b/mindspore/lite/src/weight_decoder.h index 30e574ebe0f..e8d8e52a8a2 100644 --- a/mindspore/lite/src/weight_decoder.h +++ b/mindspore/lite/src/weight_decoder.h @@ -205,6 +205,11 @@ class WeightDecoder { free(dequant_datas); return nullptr; } + if (abs(index - INT8_MIN) >= static_cast(param.clusters.size())) { + MS_LOG(ERROR) << "index exceed the boundary of param.clusters"; + free(dequant_datas); + return nullptr; + } dequant_datas[j] = static_cast
(param.clusters[index - INT8_MIN]); } else { #ifdef ENABLE_ARM32