[geos-commits] [SCM] GEOS branch 3.12 updated. 3cfdccafc8d9102e7c9bcbc193c163d8f084882b
git at osgeo.org
git at osgeo.org
Mon Feb 5 11:16:46 PST 2024
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".
The branch, 3.12 has been updated
via 3cfdccafc8d9102e7c9bcbc193c163d8f084882b (commit)
via c6bba89fed959008cc9dd74bf707f4c956ef75c2 (commit)
from 14926fef3da92787793669f083499354c51ae603 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3cfdccafc8d9102e7c9bcbc193c163d8f084882b
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Mon Feb 5 11:16:09 2024 -0800
News for GH-1039
diff --git a/NEWS.md b/NEWS.md
index c8e4d73a8..6c5e29f5c 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -11,6 +11,7 @@ xxxx-xx-xx
- Fix PreparedPolygonContains for GC with MultiPoint (GH-1008, Martin Davis)
- Fix TopologyPreservingSimplifier to prevent jumping components (GH-1012, Martin Davis)
- Fix reading WKT with EMPTY token with white space (GH-1025, Mike Taves)
+ - Segfault in CoverageSimplify for non-polygonal inputs (GH-1039, Paul Ramsey)
## Changes in 3.12.1
2023-11-11
commit c6bba89fed959008cc9dd74bf707f4c956ef75c2
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Mon Feb 5 11:14:27 2024 -0800
Fix segfault when coverage simplify called with nonpolygons, references GH-1031 (#1039)
diff --git a/src/coverage/CoverageSimplifier.cpp b/src/coverage/CoverageSimplifier.cpp
index 73b5a5e44..335b10759 100644
--- a/src/coverage/CoverageSimplifier.cpp
+++ b/src/coverage/CoverageSimplifier.cpp
@@ -20,6 +20,7 @@
#include <geos/geom/Geometry.h>
#include <geos/geom/GeometryFactory.h>
#include <geos/geom/MultiLineString.h>
+#include <geos/util/IllegalArgumentException.h>
using geos::geom::Geometry;
@@ -83,7 +84,12 @@ CoverageSimplifier::simplifyInner(
CoverageSimplifier::CoverageSimplifier(std::vector<const Geometry*>& coverage)
: m_input(coverage)
, m_geomFactory(coverage.empty() ? nullptr : coverage[0]->getFactory())
- {}
+ {
+ for (const Geometry* g: m_input) {
+ if (!g->isPolygonal())
+ throw util::IllegalArgumentException("Argument is not a non-polygonal");
+ }
+ }
/* public */
std::vector<std::unique_ptr<Geometry>>
diff --git a/tests/unit/coverage/CoverageSimplifierTest.cpp b/tests/unit/coverage/CoverageSimplifierTest.cpp
index 61e79f54e..94534544a 100644
--- a/tests/unit/coverage/CoverageSimplifierTest.cpp
+++ b/tests/unit/coverage/CoverageSimplifierTest.cpp
@@ -431,7 +431,7 @@ void object::test<24> ()
"POLYGON EMPTY",
"POLYGON EMPTY" })
);
- }
+}
// testOneEmpty
template<>
@@ -446,7 +446,7 @@ void object::test<25> ()
"POLYGON ((1 9, 9 9, 9 1, 1 1, 1 9))",
"POLYGON EMPTY" })
);
- }
+}
// testEmptyHole()
template<>
@@ -461,6 +461,26 @@ void object::test<26> ()
"POLYGON ((1 9, 9 9, 9 1, 1 1, 1 9), EMPTY)",
"POLYGON EMPTY" })
);
- }
+}
+
+// Test non-polygon inputs (GH-1031)
+template<>
+template<>
+void object::test<30> ()
+{
+ auto input = readArray({
+ "MULTILINESTRING ((200 100, 100 100, 200 200), (200 200, 200 100), (200 200, 300 100, 200 100))"
+ });
+ try {
+ std::vector<std::unique_ptr<Geometry>> result =
+ CoverageSimplifier::simplify(input, 10);
+ }
+ catch (geos::util::IllegalArgumentException& iae) {
+ ensure("caught IllegalArgumentException", true);
+ return;
+ }
+ ensure("did not throw IllegalArgumentException", false);
+}
+
} // namespace tut
-----------------------------------------------------------------------
Summary of changes:
NEWS.md | 1 +
src/coverage/CoverageSimplifier.cpp | 8 +++++++-
tests/unit/coverage/CoverageSimplifierTest.cpp | 26 +++++++++++++++++++++++---
3 files changed, 31 insertions(+), 4 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list