[geos-commits] [SCM] GEOS branch 3.12 updated. 3802326b4d063a41550d9fe411d891cdd52e68bc

git at osgeo.org git at osgeo.org
Tue Dec 16 06:56:14 PST 2025


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  3802326b4d063a41550d9fe411d891cdd52e68bc (commit)
      from  168d863da9ad23ca084372651d090afb242f8934 (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 3802326b4d063a41550d9fe411d891cdd52e68bc
Author: Daniel Baston <dbaston at gmail.com>
Date:   Tue Dec 16 09:52:36 2025 -0500

    BufferOp: Avoid crash on geometry with only invalid coordinates

diff --git a/NEWS.md b/NEWS.md
index de09ec652..0934edb9d 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -5,6 +5,7 @@
   - Fix OverlayNG coordinate dimemsion handling for EMPTY geometries (GH-1258, Martin Davis)
   - Fix DepthSegment comparison logic (really this time) (GH-1266, Martin Davis)
   - Change CoverageGapFinder to return polygons (Martin Davis)
+  - Avoid crash on buffer of geometry with only invalid coordinates (GH-1335, Dan Baston)
 
 ## Changes in 3.12.3
 2025-03-03
diff --git a/src/operation/buffer/BufferCurveSetBuilder.cpp b/src/operation/buffer/BufferCurveSetBuilder.cpp
index d57532c6f..a9d99cf09 100644
--- a/src/operation/buffer/BufferCurveSetBuilder.cpp
+++ b/src/operation/buffer/BufferCurveSetBuilder.cpp
@@ -201,6 +201,10 @@ BufferCurveSetBuilder::addLineString(const LineString* line)
 
     auto coord = operation::valid::RepeatedPointRemover::removeRepeatedAndInvalidPoints(line->getCoordinatesRO());
 
+    if (coord->isEmpty()) {
+        throw util::GEOSException("LineString has no valid points.");
+    }
+
     /**
      * Rings (closed lines) are generated with a continuous curve,
      * with no end arcs. This produces better quality linework,
diff --git a/tests/unit/operation/buffer/BufferOpTest.cpp b/tests/unit/operation/buffer/BufferOpTest.cpp
index 39f8592bb..298eaf7c6 100644
--- a/tests/unit/operation/buffer/BufferOpTest.cpp
+++ b/tests/unit/operation/buffer/BufferOpTest.cpp
@@ -3,6 +3,8 @@
 
 // tut
 #include <tut/tut.hpp>
+#include <tut/tut_macros.hpp>
+
 #include <utility.h>
 // geos
 #include <geos/operation/buffer/BufferOp.h>
@@ -21,6 +23,7 @@
 #include <string>
 #include <vector>
 
+
 using namespace geos::operation::buffer;
 
 namespace tut {
@@ -624,4 +627,19 @@ void object::test<28>
 "MULTIPOLYGON (((24 95.239, 24 96, 24 99, 24.816 99, 24 95.239)), ((3 90, 3 93, 3 96, 3 99, 21 99, 21 96, 21 93, 21 90, 3 90)))");    
 }
 
+template<>
+template<>
+void object::test<31>
+()
+{
+    set_test_name("buffer of line with only Inf coordinates");
+    // See https://github.com/libgeos/geos/issues/1332
+
+    std::string wkt = "LINESTRING (Inf Inf, Inf Inf)";
+
+    auto geom = wktreader.read(wkt);
+
+    ensure_THROW(geom->buffer(0.1), geos::util::GEOSException);
+}
+
 } // namespace tut

-----------------------------------------------------------------------

Summary of changes:
 NEWS.md                                        |  1 +
 src/operation/buffer/BufferCurveSetBuilder.cpp |  4 ++++
 tests/unit/operation/buffer/BufferOpTest.cpp   | 18 ++++++++++++++++++
 3 files changed, 23 insertions(+)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list