ifcplusplus icon indicating copy to clipboard operation
ifcplusplus copied to clipboard

Out of bounds vector in simplifyPolygon

Open antoine-fresse opened this issue 2 years ago • 1 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 d2b0e9c4f550515acadb26120c2356649351a7ae messed things up

Regards, Antoine

antoine-fresse avatar Jan 10 '24 17:01 antoine-fresse

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

ifcquery avatar Jan 27 '24 03:01 ifcquery

This should be solved with previous update

ifcquery avatar Apr 30 '24 13:04 ifcquery