Skip to content
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

Potential seg-fault in initialize_cameras_landmarks #1639

Open
OwenMcGee opened this issue Jun 29, 2022 · 1 comment
Open

Potential seg-fault in initialize_cameras_landmarks #1639

OwenMcGee opened this issue Jun 29, 2022 · 1 comment
Labels

Comments

@OwenMcGee
Copy link
Collaborator

In arrows/mvg/algo/initialize_cameras_landmarks.h, the initialize function gives a default value for the constraints parameter as nullptr. However, as far as I can tell actually calling the function with the default parameter will always result in a crash.

The constraints parameter will be passed into initialize_keyframes, which will then pass it into metadata_centric_keyframe_initialization, which will then reach reach line 2440, and crash.

I'm unsure if the solution for this is to simply remove the default value for the constraints parameter, or if additional checks and cases for a value of nullptr are needed throughout the code called by the function. I believe the default value for the parameter was ported over from the arrows/mvg/algo/initialize_cameras_landmarks_basic.h file.

@mleotta
Copy link
Member

mleotta commented Jun 30, 2022

Additional checks are needed. Anywhere we use pointer or shared_pointer we need to check that the pointer is not null before dereferencing it unless there was already an earlier check guaranteeing it was not null. The contraints are intended to be optional so null is valid input. Line 2440 and other places like it should start like this

if(constraints &&
   constraints->get_...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants