Open astaa-nrec opened 11 years ago
Thanks for the clear issue report. I'll look into making a fix for this when I get a chance, but this will get addressed faster if you can provide a pull request. I'll report back here when I start working on a fix (as not to have us both working on it).
Consider the program:
We can get this program to freeze by sending the message:
The program gets stuck in this loop in pcl_ros/point_cloud.h:
Two different ways this could be fixed:
1) Add an assertion like:
This says that if the message has no data content, then its width and height fields are zero. This is better than just
assert(data_size > 0)
because we don't want default empty messages to crash the node.2) Add a conditional like:
so that no memcpy loop is attempted if it is known that the message has no data content. This would have the advantage of not crashing the node when such a message arrives.
(edited:
data_size
is probably the right variable to check, notrow_step
)