ifcquery/ifcplusplus

Out of bounds vector in simplifyPolygon

antoine-fresse opened this issue · 2 comments

Hello,

in the function simplifyPolygon (the one that takes a vector of vec2) inside GeomUtils.h there are multiple unsafe erase calls : polygon.erase(polygon.begin() + ii - 1); that cause a crash when ii is 0.

Looks like d2b0e9c messed things up

Regards,
Antoine

Some changes are already made, so there is only this erase left:

size_t idx1 = ii % polygon.size();
polygon.erase(polygon.begin() + idx1);

polygon.size() is always > 1, so the iterator can never be at the end

This should be solved with previous update