-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
[BUG FIX] getCorrespondenceScore must not go out-of-bounds. #6070
base: master
Are you sure you want to change the base?
[BUG FIX] getCorrespondenceScore must not go out-of-bounds. #6070
Conversation
Forgot to mention, at my side, on several different point clouds as inputs, even with this fix, crashes occurs around here: https://github.com/fghoussen/pcl/blob/d257a89130386c3356fba8ba0f04e8e2089704f3/registration/src/correspondence_rejection_median_distance.cpp#L59 Not sure how this is safe when distance are max'ed by bad correspondence score |
If you say that it does not really solve the problem, I would rather investigate how the crash actually happens, and then create a fix based on that. Can you provide a full program that I can use to easily reproduce the crash? Including source and target cloud, e.g. from the pcl test directory, |
With my data, following examples you mentioned, I get crash on a regular basis.
Unfortunately not that easy: I can't provide data (not mine - need to check if I can share them) and they are big files (not great to commit in repo IMO), the original code can not be compiled in full debug (= difficult to analyse crash as you do not get all symbols) |
I don't think it is a good idea to merge a change if the bug is not really understood. This seems to treat the symptoms, but potentially does not solve the bug itself. In the worst case, these checks could hide a more severe bug somewhere else in the code.
In case you can't share the data, you could try to use a point cloud from the pcl test directory ( https://github.com/PointCloudLibrary/pcl/tree/master/test ) or from the pcl data repo ( https://github.com/PointCloudLibrary/data ). How many points do the point clouds have that you use? I am asking because if it is a certain number (several millions or even billions), this might point to a specific kind of bug. |
I'll see what I can do... Look closely at the patch (hidding whitespaces): this is only bound checking
I understand your point of view. But the problem is now understood: after bound checking, the code is stable.
Not sure. Need to check. This will be time consuming too...
The problem seems to lie in the data (= point cloud). Reducing point cloud to minimal setting is impossible (I do not know what trigger the problem in the PCL code) and modifying point cloud will be time consuming too (possibly making the problem disappear).
Once again, not sure I'll have time for this: I already spent more time than expected. I'll see what I can do... |
Adding a unit test with data from https://github.com/PointCloudLibrary/pcl/tree/master/test may or may not reproduce the problem. Could you add one on top of this PR? If not, I'll see if I have time... But I can't guarantee |
The problem is maybe silent in the current test suite: how to run the test suite? |
|
I've just tested: the test suite doesn't see the problem which confirm it seems related to the point clouds used as input |
[BUG FIX] getCorrespondenceScore must not go out-of-bounds.
I have a quite systematic crash when using
pcl::registration::CorrespondenceRejectorMedianDistance
orpcl::registration::CorrespondenceRejectorSurfaceNormal
.I use it like so:
If any mistake (explaining crashes ?) is obvious, I'd be glad to know.
In any cases, the attached patch seem to make things better (less often crash) but does not solve the problem (crash occurs on a regular basis).
The patch is basically "each time I access a member, check the index is consistent with the member size, or, return default value (here maximum value to say the score is as bad as possible AFAIU the code)"
I pushed this to let the PCL community decide if this patch is worth being merged or not.