mmcv
mmcv copied to clipboard
[Bug]dynamic_voxelize_kernel: when ndim <3, point_offset maybe overflow buffer.
Prerequisite
- [X] I have searched Issues and Discussions but cannot get the expected help.
- [X] The bug has not been fixed in the latest version(https://github.com/open-mmlab/mmcv).
Environment
The shape of points is [num_points, num_features] In voxelize.py:
Convert kitti points(N, >=3) to voxels.
Args:
points (torch.Tensor): [N, ndim]. Points[:, :3] contain xyz points
and points[:, 3:] contain other information like reflectivity.
In host cpp, There are no restrictions on point shape In voxelization_cuda_kernel.cuh,If num_features are less than 3, it may cause points_offset buffer overflow. So I think it is more appropriate to add the limit of num_features greater than 3 in the host cpp code
int c_x = floorf((points_offset[0] - coors_x_min) / voxel_x);
if (c_x < 0 || c_x >= grid_x) {
coors_offset[0] = -1;
continue;
}
int c_y = floorf((points_offset[1] - coors_y_min) / voxel_y);
if (c_y < 0 || c_y >= grid_y) {
coors_offset[0] = -1;
coors_offset[1] = -1;
continue;
}
int c_z = floorf((points_offset[2] - coors_z_min) / voxel_z);
if (c_z < 0 || c_z >= grid_z) {
coors_offset[0] = -1;
coors_offset[1] = -1;
coors_offset[2] = -1;
} else {
coors_offset[0] = c_z;
coors_offset[1] = c_y;
coors_offset[2] = c_x;
}
Reproduces the problem - code sample
no python
Reproduces the problem - command or script
no python
Reproduces the problem - error message
no python
Additional information
no python