[osrm] 01/04: Imported Upstream version 5.2.6+ds

Bas Couwenberg sebastic at debian.org
Sat Jun 25 09:29:13 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository osrm.

commit 772829c45d3c193a11e4d128669a50d9a1c6c800
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sat Jun 25 02:07:53 2016 +0200

    Imported Upstream version 5.2.6+ds
---
 CHANGELOG.md                               | 4 ++++
 CMakeLists.txt                             | 2 +-
 src/util/coordinate_calculation.cpp        | 5 ++++-
 unit_tests/util/coordinate_calculation.cpp | 7 +++++++
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e11f4ff..a6bae25 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 5.2.6
+  - Bugfixes
+    - Fix numeric overflow in roundabout center calculation which throws an exception
+
 # 5.2.5
   - Bugfixes
     - Fixes a segfault caused by incorrect trimming logic for very short steps.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3fe7b43..6697ab7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,7 @@ endif()
 project(OSRM C CXX)
 set(OSRM_VERSION_MAJOR 5)
 set(OSRM_VERSION_MINOR 2)
-set(OSRM_VERSION_PATCH 5)
+set(OSRM_VERSION_PATCH 6)
 
 # these two functions build up custom variables:
 #   OSRM_INCLUDE_PATHS and OSRM_DEFINES
diff --git a/src/util/coordinate_calculation.cpp b/src/util/coordinate_calculation.cpp
index 7dafb78..b2bdd3e 100644
--- a/src/util/coordinate_calculation.cpp
+++ b/src/util/coordinate_calculation.cpp
@@ -258,7 +258,10 @@ circleCenter(const Coordinate C1, const Coordinate C2, const Coordinate C3)
                             C2C1_slope * (C2_x + C3_x)) /
                            (2 * (C3C2_slope - C2C1_slope));
         const double lat = (0.5 * (C1_x + C2_x) - lon) / C2C1_slope + 0.5 * (C1_y + C2_y);
-        return Coordinate(FloatLongitude(lon), FloatLatitude(lat));
+        if (lon < -180.0 || lon > 180.0 || lat < -90.0 || lat > 90.0)
+            return boost::none;
+        else
+            return Coordinate(FloatLongitude(lon), FloatLatitude(lat));
     }
 }
 
diff --git a/unit_tests/util/coordinate_calculation.cpp b/unit_tests/util/coordinate_calculation.cpp
index 147baca..2d2510e 100644
--- a/unit_tests/util/coordinate_calculation.cpp
+++ b/unit_tests/util/coordinate_calculation.cpp
@@ -302,6 +302,13 @@ BOOST_AUTO_TEST_CASE(circleCenter)
     c = Coordinate(FloatLongitude(-112.096419), FloatLatitude(41.147259));
     result = coordinate_calculation::circleCenter(a, b, c);
     BOOST_CHECK(!result);
+
+    // Out of bounds
+    a = Coordinate(FloatLongitude(-112.096234), FloatLatitude(41.147258));
+    b = Coordinate(FloatLongitude(-112.106606), FloatLatitude(41.147259));
+    c = Coordinate(FloatLongitude(-113.096419), FloatLatitude(41.147258));
+    result = coordinate_calculation::circleCenter(a, b, c);
+    BOOST_CHECK(!result);
 }
 
 BOOST_AUTO_TEST_SUITE_END()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osrm.git



More information about the Pkg-grass-devel mailing list