Skip to content
  • Studer Gabriel's avatar
    BUGFIX: Fix potential segfault when calling Merge on RotamerGroup · 8de5cba2
    Studer Gabriel authored
    The offending lines were:
    connectivity_[return_idx].first = this->Generate(x, y, z, l);
    connectivity_[return_idx].second = this->Generate(x, y, z, r);
    
    The Generate function triggers a potential reallocation of connectivity_
    due to a push_back, thus making the assignment operation writing to the
    wrong location in memory.
    The usual implementation of std::vector doubles the size when
    reallocating. So if constructing rotamer groups frames etc. from scratch,
    exactly one reallocation happened before the lines specified before. The
    size of connectivity was then sufficient and no further reallocation
    was necessary. In case of merging a rotamer group, we reset the tree
    and connectivity_ already has a certain size, making reallocations
    unpredictable. Long story short: Default sidechain reconstruction was
    already safe before (if you're not using an exotic std::vector
    implementation) but Merge might have caused an issue.
    8de5cba2