diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/lite_mat.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/lite_mat.cc index 636dfc9e71..bee338d8a4 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/lite_mat.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/lite_mat.cc @@ -296,7 +296,7 @@ void LiteMat::AlignFree(void *ptr) { inline void LiteMat::InitElemSize(LDataType data_type) { elem_size_ = data_type.SizeInBytes(); } bool LiteMat::GetROI(int x, int y, int w, int h, LiteMat &m) { - if (x < 0 || y < 0 || x > width_ - w || h > height_ - y || w < 0 || h < 0) { + if (x < 0 || y < 0 || x > width_ - w || h > height_ - y || w <= 0 || h <= 0) { return false; } if (!m.IsEmpty()) {