Skip to content

Bug in Consensus.cpp #41

@cmmw

Description

@cmmw

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions