Skip to content
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

Correct resize to prevent SIGSEGV on HDL64 S3. #328

Open
wants to merge 2 commits into
base: dashing-devel
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,12 @@ class DataContainerBase
cloud.height = config_.init_height;
cloud.is_dense = static_cast<uint8_t>(config_.is_dense);
cloud.row_step = cloud.width * cloud.point_step;
cloud.data.resize(scan_msg->packets.size() * config_.scans_per_packet * cloud.point_step);
int data_size = scan_msg->packets.size() * config_.scans_per_packet * cloud.point_step;
// additional space is required for HDL64 S3
if (!cloud.is_dense && cloud.width == 64) {
data_size = scan_msg->packets.size() * config_.scans_per_packet * cloud.point_step * 2;
}
cloud.data.resize(data_size);
// Clear out the last data; this is important in the organized cloud case
std::fill(cloud.data.begin(), cloud.data.end(), 0);
if (config_.transform) {
Expand Down