Avoid crashing if there is a polygon ring containing only one point (#102)

This commit is contained in:
Erica Fischer
2023-05-11 12:20:00 -07:00
committed by GitHub
parent 523ca55243
commit 20eb9c8dae
3 changed files with 15 additions and 1 deletions
+4
View File
@@ -1,3 +1,7 @@
# 2.26.1
* Avoid crashing if there is a polygon ring with only one point
# 2.26.0 # 2.26.0
* Fix bugs in --no-simplification-of-shared-nodes * Fix bugs in --no-simplification-of-shared-nodes
+10
View File
@@ -1049,6 +1049,16 @@ drawvec fix_polygon(drawvec &geom) {
} }
} }
// A polygon ring must contain at least three points
// (and really should contain four). If this one does
// not have enough, avoid a division by zero trying to
// calculate the centroid below.
if (j - i < 3) {
i = j - 1;
outer = 0;
continue;
}
// Make a temporary copy of the ring. // Make a temporary copy of the ring.
// Close it if it isn't closed. // Close it if it isn't closed.
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef VERSION_HPP #ifndef VERSION_HPP
#define VERSION_HPP #define VERSION_HPP
#define VERSION "v2.26.0" #define VERSION "v2.26.1"
#endif #endif