diff --git a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc index ad7d5f8900..8fda9d2a49 100644 --- a/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc +++ b/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv/image_process.cc @@ -306,9 +306,9 @@ static bool ConvertYUV420SPToBGR(const uint8_t *data, LDataType data_type, bool const uint8_t *y_ptr = data; const uint8_t *uv_ptr = y_ptr + w * h; uint8_t *bgr_ptr = mat; - int bgr_stride = 3 * w; + const int bgr_stride = 3 * w; - for (int y = 0; y < h; ++y) { + for (uint64_t y = 0; y < h; ++y) { uint8_t *bgr_buf = bgr_ptr; const uint8_t *uv_buf = uv_ptr; const uint8_t *y_buf = y_ptr; 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 b44d8375d7..1ce034d41c 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 @@ -15,7 +15,7 @@ */ #include "minddata/dataset/kernels/image/lite_cv/lite_mat.h" -#include +#include #include #include #ifdef ENABLE_ANDROID @@ -252,7 +252,7 @@ void LiteMat::Release() { void *LiteMat::AlignMalloc(unsigned int size) { unsigned int length = sizeof(void *) + ALIGN - 1; - if (size > INT_MAX - length) { + if (size > std::numeric_limits::max() - length) { return nullptr; } void *p_raw = reinterpret_cast(malloc(size + length));