[geos-commits] [SCM] GEOS branch 3.14 updated. a3d7aa413d0975c54491e31e91b9f92a35425fb1

git at osgeo.org git at osgeo.org
Wed Dec 10 11:16:35 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.14 has been updated
       via  a3d7aa413d0975c54491e31e91b9f92a35425fb1 (commit)
       via  314ca48155b30640c1cd150597bcdfb4ede43389 (commit)
      from  d18db3a1108a504938e7da4f7818c7195cc021c4 (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 a3d7aa413d0975c54491e31e91b9f92a35425fb1
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Dec 10 11:15:55 2025 -0800

    NEWS.md

diff --git a/NEWS.md b/NEWS.md
index cf736c28d..712f49a09 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -4,6 +4,7 @@
 
 - Fixes/Improvements:
   - Relax other floating-point exception handling with other compilers (GH-1333, Mike Taves)
+  - Quiet FP_DIVBYZERO exception from CGAlgorithmsDD::intersection (GH-1235, Paul Ramsey)
 
 ## Changes in 3.14.1
 2025-10-27

commit 314ca48155b30640c1cd150597bcdfb4ede43389
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Dec 10 11:13:59 2025 -0800

    Quiet FP_DIVBYZERO exception from CGAlgorithmsDD::intersection showing in downstream libraries, closes #1235

diff --git a/include/geos/math/DD.h b/include/geos/math/DD.h
index 61e3a08a7..764801251 100644
--- a/include/geos/math/DD.h
+++ b/include/geos/math/DD.h
@@ -114,6 +114,7 @@ class GEOS_DLL DD {
         int signum() const;
         DD rint() const;
 
+        void setNaN();
 
     public:
         DD(double p_hi, double p_lo) : hi(p_hi), lo(p_lo) {};
@@ -165,6 +166,7 @@ class GEOS_DLL DD {
         static DD pow(const DD &d, int exp);
         static DD trunc(const DD &d);
 
+        bool isInf() const;
         bool isNaN() const;
         bool isNegative() const;
         bool isPositive() const;
diff --git a/src/algorithm/CGAlgorithmsDD.cpp b/src/algorithm/CGAlgorithmsDD.cpp
index 0d61b335e..df6fd0112 100644
--- a/src/algorithm/CGAlgorithmsDD.cpp
+++ b/src/algorithm/CGAlgorithmsDD.cpp
@@ -139,19 +139,12 @@ CGAlgorithmsDD::intersection(const CoordinateXY& p1, const CoordinateXY& p2,
     DD y = (qx * pw) - (px * qw);
     DD w = (px * qy) - (qx * py);
 
+    if (w.isZero())
+        return CoordinateXY::getNull();
+
     double xInt = (x / w).ToDouble();
     double yInt = (y / w).ToDouble();
-
-    Coordinate rv;
-
-    if (!std::isfinite(xInt) || !std::isfinite(yInt)) {
-        rv.setNull();
-        return rv;
-    }
-
-    rv.x = xInt;
-    rv.y = yInt;
-    return rv;
+    return {xInt, yInt};
 }
 
 /* public static */
diff --git a/src/math/DD.cpp b/src/math/DD.cpp
index c620c1b62..86d284a11 100644
--- a/src/math/DD.cpp
+++ b/src/math/DD.cpp
@@ -20,8 +20,16 @@
 namespace geos {
 namespace math { // geos.util
 
-
-
+/* private */
+void DD::setNaN()
+{
+    hi = std::numeric_limits<double>::quiet_NaN();
+}
+/* public */
+bool DD::isInf() const
+{
+    return std::isinf(hi);
+}
 /* public */
 bool DD::isNaN() const
 {
@@ -346,6 +354,7 @@ DD DD::determinant(double x1, double y1, double x2, double y2)
     return determinant(DD(x1), DD(y1), DD(x2), DD(y2) );
 }
 
+
 /**
 * Computes the value of this number raised to an integral power.
 * Follows semantics of Java Math.pow as closely as possible.
diff --git a/tests/unit/algorithm/MinimumAreaRectangleTest.cpp b/tests/unit/algorithm/MinimumAreaRectangleTest.cpp
index a36723bb8..55cf17826 100644
--- a/tests/unit/algorithm/MinimumAreaRectangleTest.cpp
+++ b/tests/unit/algorithm/MinimumAreaRectangleTest.cpp
@@ -147,35 +147,37 @@ template<>
 template<>
 void object::test<10>()
 {
-    // bool error = false;
-    // try {
-        checkMinRectangle(
-            "LINESTRING(-99.48710639268086 34.79029839231914,-99.48370699999998 34.78689899963806,-99.48152167568102 34.784713675318976)",
-            "POLYGON ((-99.48710639268066 34.790298392318675, -99.48710639268066 34.790298392318675, -99.48152167568082 34.78471367531866, -99.48152167568082 34.78471367531866, -99.48710639268066 34.790298392318675))");
-    // } catch (std::exception& e) {
-    //     error = true;
-    //     // errorMessage = e.what();
-    // }
-    // ensure("caught exception", error == true);
+    checkMinRectangle(
+        "LINESTRING(-99.48710639268086 34.79029839231914,-99.48370699999998 34.78689899963806,-99.48152167568102 34.784713675318976)",
+        "POLYGON ((-99.48710639268066 34.790298392318675, -99.48710639268066 34.790298392318675, -99.48152167568082 34.78471367531866, -99.48152167568082 34.78471367531866, -99.48710639268066 34.790298392318675))");
 }
 
+
 // testBadRectl
 template<>
 template<>
 void object::test<11>()
 {
-    // bool error = false;
-    // try {
     checkMinRectangle(
         "POLYGON ((-5.21175 49.944633, -5.77435 50.021367, -5.7997 50.0306, -5.81815 50.0513, -5.82625 50.073567, -5.83085 50.1173, -6.2741 56.758767, -5.93245 57.909, -5.1158 58.644533, -5.07915 58.661733, -3.42575 58.686633, -3.1392 58.6685, -3.12495 58.666233, -1.88745 57.6444, 1.68845 52.715133, 1.7057 52.6829, 1.70915 52.6522, 1.7034 52.585433, 1.3867 51.214033, 1.36595 51.190267, 1.30485 51.121967, 0.96365 50.928567, 0.93025 50.912433, 0.1925 50.7436, -5.21175 49.944633))",
         "POLYGON ((1.8583607388069103 50.41649058582797, -5.816631979932251 49.904263313964535, -6.395241388167441 58.57389735949991, 1.2797513305717105 59.08612463136336, 1.8583607388069103 50.41649058582797))");
-    // } catch (std::exception& e) {
-    //     error = true;
-    //     // errorMessage = e.what();
-    // }
-    // ensure("caught exception", error == true);
 }
 
 
+// https://github.com/libgeos/geos/issues/1235
+// throwing FE_DIVBYZERO
+template<>
+template<>
+void object::test<12>()
+{
+    checkMinRectangle(
+        "POLYGON ((-100 -100, -100 100, 100 100, 100 -100, -100 -100))",
+        "POLYGON ((-100 -100, -100 100, 100 100, 100 -100, -100 -100))");
+}
+
+
+
+
+
 } // namespace tut
 
diff --git a/tests/unit/geos_unit.cpp b/tests/unit/geos_unit.cpp
index 9526b009e..cbd1a86cc 100644
--- a/tests/unit/geos_unit.cpp
+++ b/tests/unit/geos_unit.cpp
@@ -50,7 +50,7 @@ usage()
          << "  " << module << " geos::geom::Envelope\n"
          << "  " << module << " geos::geom::Envelope 2\n"
          << endl
-         << "GEOS homepage: http://geos.osgeo.org" << endl;
+         << "GEOS homepage: https://libgeos.org" << endl;
 }
 
 int

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

Summary of changes:
 NEWS.md                                           |  1 +
 include/geos/math/DD.h                            |  2 ++
 src/algorithm/CGAlgorithmsDD.cpp                  | 15 +++-------
 src/math/DD.cpp                                   | 13 ++++++--
 tests/unit/algorithm/MinimumAreaRectangleTest.cpp | 36 ++++++++++++-----------
 tests/unit/geos_unit.cpp                          |  2 +-
 6 files changed, 38 insertions(+), 31 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list