From: @shenwei41 Reviewed-by: @liucunwei,@heleiwang Signed-off-by: @liucunweitags/v1.1.0
| @@ -306,9 +306,9 @@ static bool ConvertYUV420SPToBGR(const uint8_t *data, LDataType data_type, bool | |||||
| const uint8_t *y_ptr = data; | const uint8_t *y_ptr = data; | ||||
| const uint8_t *uv_ptr = y_ptr + w * h; | const uint8_t *uv_ptr = y_ptr + w * h; | ||||
| uint8_t *bgr_ptr = mat; | 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; | uint8_t *bgr_buf = bgr_ptr; | ||||
| const uint8_t *uv_buf = uv_ptr; | const uint8_t *uv_buf = uv_ptr; | ||||
| const uint8_t *y_buf = y_ptr; | const uint8_t *y_buf = y_ptr; | ||||
| @@ -15,7 +15,7 @@ | |||||
| */ | */ | ||||
| #include "minddata/dataset/kernels/image/lite_cv/lite_mat.h" | #include "minddata/dataset/kernels/image/lite_cv/lite_mat.h" | ||||
| #include <limits.h> | |||||
| #include <limits> | |||||
| #include <algorithm> | #include <algorithm> | ||||
| #include <cmath> | #include <cmath> | ||||
| #ifdef ENABLE_ANDROID | #ifdef ENABLE_ANDROID | ||||
| @@ -252,7 +252,7 @@ void LiteMat::Release() { | |||||
| void *LiteMat::AlignMalloc(unsigned int size) { | void *LiteMat::AlignMalloc(unsigned int size) { | ||||
| unsigned int length = sizeof(void *) + ALIGN - 1; | unsigned int length = sizeof(void *) + ALIGN - 1; | ||||
| if (size > INT_MAX - length) { | |||||
| if (size > std::numeric_limits<uint32_t>::max() - length) { | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| void *p_raw = reinterpret_cast<void *>(malloc(size + length)); | void *p_raw = reinterpret_cast<void *>(malloc(size + length)); | ||||