From 776c0d0ae261d74db81de251e164a0a522bf544a Mon Sep 17 00:00:00 2001 From: "Daniel J. Hofmann" Date: Tue, 22 Mar 2016 11:01:37 +0100 Subject: [PATCH] Fixes integer overflow due to fixed / floating mismatch in coordinate interpolation --- src/util/coordinate_calculation.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/coordinate_calculation.cpp b/src/util/coordinate_calculation.cpp index 5d788304b..5eafe9fae 100644 --- a/src/util/coordinate_calculation.cpp +++ b/src/util/coordinate_calculation.cpp @@ -261,10 +261,10 @@ Coordinate interpolateLinear(double factor, const Coordinate from, const Coordin { BOOST_ASSERT(0 <= factor && factor <= 1.0); - FloatLongitude interpolated_lon{((1. - factor) * static_cast(from.lon)) + - (factor * static_cast(to.lon))}; - FloatLatitude interpolated_lat{((1. - factor) * static_cast(from.lat)) + - (factor * static_cast(to.lat))}; + FixedLongitude interpolated_lon(((1. - factor) * static_cast(from.lon)) + + (factor * static_cast(to.lon))); + FixedLatitude interpolated_lat(((1. - factor) * static_cast(from.lat)) + + (factor * static_cast(to.lat))); return {std::move(interpolated_lon), std::move(interpolated_lat)}; }