Skip to content

CHUNK_ID_XYZI voxel bounds check to improve handling of corrupt files #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/ogt_vox.h
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,9 @@
uint8_t z = packed_voxel_data[i * 4 + 2];
uint8_t color_index = packed_voxel_data[i * 4 + 3];
ogt_assert(x < size_x && y < size_y && z < size_z, "invalid data in XYZI chunk");
voxel_data[(x * k_stride_x) + (y * k_stride_y) + (z * k_stride_z)] = color_index;
if(x < size_x && y < size_y && z < size_z ) {
voxel_data[(x * k_stride_x) + (y * k_stride_y) + (z * k_stride_z)] = color_index;
}
}
_vox_file_seek_forwards(fp, num_voxels_in_chunk * 4);
// compute the hash of the voxels in this model-- used to accelerate duplicate models checking.
Expand Down