mirror of
https://github.com/boostorg/geometry.git
synced 2026-01-30 20:02:11 +00:00
Fix potential unsigned integer overflow in find_polygons_for_source
An invalid polygon will trigger overflow when `previous_rank` is `0` as `previous_rank - 1` will overflow. This can be detected by passing an invalid polygon like `[[8128,3600],[8224,3664],[8128,3600]]` into `boost::geometry::intersection` and compiling with `-fsanitize=undefined`
This commit is contained in:
@@ -521,7 +521,7 @@ private :
|
||||
{
|
||||
rp& ranked = m_ranked_points[index];
|
||||
|
||||
if (ranked.rank != previous_rank && ! in_polygon)
|
||||
if (previous_rank > 0 && ranked.rank != previous_rank && ! in_polygon)
|
||||
{
|
||||
assign_ranks(last_from_rank, previous_rank - 1, 1);
|
||||
assign_ranks(last_from_rank + 1, previous_rank, 2);
|
||||
|
||||
Reference in New Issue
Block a user