未验证 提交 3905a5cb 编写于 作者: B BUG1989 提交者: GitHub

Fix security (#655)

* fix, some warning

* fix alerts
上级 dc90705e
......@@ -454,7 +454,7 @@ static void run_yolo(graph_t graph, std::vector<BBoxRect> &boxes, int img_width,
bool letterbox = false;
float roi_left = 0.f, roi_top = 0.f, roi_width = 1.f, roi_height = 1.f;
if (true == letterbox)
if (letterbox)
{
if (img_width > img_height)
{
......
......@@ -294,7 +294,7 @@ void get_input_data_focus_uint8(const char* image_file, uint8_t* input_data, int
img_new.convertTo(img_new, CV_32FC3);
float* img_data = (float* )img_new.data;
float* input_temp = (float* )malloc(3 * letterbox_cols * letterbox_rows * sizeof(float));
float* input_temp = (float* )malloc(3 * (size_t)letterbox_cols * letterbox_rows * sizeof(float));
/* nhwc to nchw */
for (int h = 0; h < letterbox_rows; h++)
......
......@@ -2565,7 +2565,7 @@ int conv_dw_run(struct tensor* input_tensor, struct tensor* weight_tensor, struc
input_tmp = input;
else
{
input_tmp = ( float* )sys_malloc(inh_tmp * inw_tmp * group * sizeof(float));
input_tmp = ( float* )sys_malloc((size_t)inh_tmp * inw_tmp * group * sizeof(float));
#pragma omp parallel for num_threads(num_thread)
for (int g = 0; g < group; g++)
{
......
......@@ -1716,7 +1716,7 @@ static void pack4(float* input, float* input_buffer, int in_h, int in_w)
{
for (int c = 0; c < PACK4; c++)
{
input_buffer[i * in_w * PACK4 + j * PACK4 + c] = input[c * in_w * in_h + i * in_w + j];
input_buffer[i * in_w * PACK4 + j * PACK4 + c] = input[(unsigned long)c * in_w * in_h + i * in_w + j];
}
}
}
......
......@@ -223,7 +223,7 @@ static int run(struct node_ops* node_ops, struct exec_node* exec_node, struct ex
int batch_size = input_tensor->dims[1];
int output_len = rnn_param->output_len;
float* init_h = ( float* )malloc(batch_size * hidden_size * sizeof(float));
float* init_h = ( float* )malloc((size_t)batch_size * hidden_size * sizeof(float));
if (init_h == NULL)
{
return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册