Skip to content

Uninitialized memory in rs2_project_color_pixel_to_depth_pixel #11006

@stefanhige

Description

@stefanhige
Required Info
Camera Model D455
Firmware Version 05.13.00.50
Operating System & Version Win10
Kernel Version (Linux Only) --
Platform PC
SDK Version 2.50.0
Language python
Segment --

Issue Description

Python utility function rs2_project_color_pixel_to_depth_pixel defined here

m.def("rs2_project_color_pixel_to_depth_pixel", cp_to_dp, "data"_a, "depth_scale"_a,

returns possibly uninitialized memory from line

std::array<float, 2> to_pixel;

if the equivalent cpp function rs2_project_color_pixel_to_depth_pixel iterates through a trajectory that maps to all-zero depth values.
if (depth == 0)

This also happens in practice in my application.

Possible fix would be
std::array<float, 2> to_pixel{-1.0f, -1.0f};
or similar, indicating to the caller that no valid pixel could be found.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions