leetcode54通过但是再vs上会有警告

leetcode54 螺旋数组
leetcode该题是通过的
但是在vs上编写的时候却会有警告
分配内存报错内存溢出,vs2022报错ret是0字节的数组
请问为什么会出现这样的警告,可以忽略这样的警告吗?

img

enum action {Toright, Tobottom, Toleft, Totop};
int* spiralOrder(int** matrix, int matrixSize, int* matrixColSize, int* returnSize) {
    *returnSize = 0;
    if (matrixSize == 0)
        return 0;
    int len = matrixSize * (*matrixColSize);
    int* ret = (int*)malloc(sizeof(int) * len);
    if (ret == NULL)
        exit(-1);
    int top = 0;
    int bottom = matrixSize - 1;
    int left = 0;
    int right = *matrixColSize - 1;
    enum action act = Toright;
    int count = 0;
    int i = 0, j = 0;
    
    while (count != len - 1)
    {
        switch (act)
        {
        case Toright:
        {
            for (; j < right; j++)
                ret[count++] = matrix[i][j];
            top++;
            act++;
        }break;
        case Tobottom:
        {
            for (; i < bottom; i++)
                ret[count++] = matrix[i][j];
            right--;
            act++;
        }break;
        case Toleft:
        {
            for (; j > left; j--)
                ret[count++] = matrix[i][j];
            bottom--;
            act++;
        }break;
        case Totop:
        {
            for (; i > top; i--)
                ret[count++] = matrix[i][j];
            left++;
            act = Toright;
        }break;
        }
    }
    ret[count] = matrix[i][j];
    

    *returnSize = len;
    return ret;
}

可以忽略,VS2019以上的编译器太过严格,有时候是一种过分的检查