SICKAG / sick_safetyscanners2

ROS2 driver for SICK safety laser scanners
https://www.sick.com/de/en/opto-electronic-protective-devices/safety-laser-scanners/c/g187225
Apache License 2.0
28 stars 30 forks source link

Unsafe pointer access #14

Closed guilyx closed 2 years ago

guilyx commented 2 years ago

Description

m_msg_creator variable was initialized after UDP callback function was established so whenever a UDP packet came, if it so happened that m_msg_creator was not initialized yet, it would crash because the callback function accesses m_msg_creator Fix:

Fix

Added a check in UDP callback function for m_msg_creator object is not null. Moved the m_msg_creator initialization statement from on_activate() to just after UDP callback initialization in on_configure().

This solves the multiple issues we had with the scanner process dying early.