Skip to content

Fix out-of-bounds memory write

An out-of-bounds memory write could occur in GetSingleLoop() when the condition (pointCells->GetNumberOfIds() < 2). GetSingleLoop() adds a line cell to complete a loop in this case, but that fact was not accounted for in the caller when allocating the argument for the lineBool array. Fixed that, and cleaned up the code by using a std::vector instead of an array. Finally, added a test that exercises the condition to make sure it is tested.

Merge request reports