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

Bug in Consensus.cpp #41

Open
cmmw opened this issue Jun 9, 2016 · 0 comments
Open

Bug in Consensus.cpp #41

cmmw opened this issue Jun 9, 2016 · 0 comments

Comments

@cmmw
Copy link

cmmw commented Jun 9, 2016

Hello!

There is a bug in Consensus.cpp. At line 129 you create an object of type cluster_result as follows:

cluster_result Z(N-1);

Now when there is only one point in the vector 'points' the expressoin N-1 is 0, and the array inside object Z, (which is also named Z) is initialized with length 0.
Later in Consensus.cpp at line 145
MST_linkage_core(N,D,Z)
is called, and inside this function
Z2.append(0, idx2, min);
is called, where Z2 is the parameter Z.
Z2.append() then accesses Z[pos] with pos=0 (and smashes the stack for me), since the array has a length of 0 dereferencing it leads to undefined behaviour.

Using cluster_result Z(N); fixed it for me.

Best regards,
Christian

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

No branches or pull requests

1 participant