Skip to content

Conversation

@Egor18
Copy link

@Egor18 Egor18 commented Nov 2, 2020

This PR is to fix segmentation fault that occures when align_depth is enabled and we subscribe to one of the camera/aligned_depth_to_* topics.
The issue was that the _unit_step_size was not initialized before getParameters() call, but inside getParameters it is used when calculating _aligned_depth_images vectors size:

_aligned_depth_images[DEPTH].resize(_width[DEPTH] * _height[DEPTH] * _unit_step_size[DEPTH]);

So all the vectors inside _aligned_depth_images had size of 0 and because of that later on data() returned nullptr and we had segfault when trying to call memset with a null pointer

auto& out_vec = _aligned_depth_images[sip];
alignFrame(_stream_intrinsics[DEPTH], _stream_intrinsics[sip],
depth_frame, from_image_frame.get_bytes_per_pixel(),
_depth_to_other_extrinsics[sip], out_vec);

uint8_t* p_out_frame = out_vec.data();
static const auto blank_color = 0x00;
memset(p_out_frame, blank_color, other_intrin.height * other_intrin.width * output_image_bytes_per_pixel);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants