diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b0587fe2..23293221e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ - replaced lhs/rhs profiles by using test defined profiles - Trip Plugin - changed internal behaviour to prefer the smallest lexicographic result over the largest one + - Bugfixes + - fixed a bug where polyline decoding on a defective polyline could end up in out-of-bound access on a vector # 5.4.0 - Changes from 5.3.0 diff --git a/src/engine/polyline_compressor.cpp b/src/engine/polyline_compressor.cpp index 1dc9b7045..11954b5d7 100644 --- a/src/engine/polyline_compressor.cpp +++ b/src/engine/polyline_compressor.cpp @@ -100,7 +100,7 @@ std::vector decodePolyline(const std::string &geometry_string) b = geometry_string.at(index++) - 63; result |= (b & 0x1f) << shift; shift += 5; - } while (b >= 0x20); + } while (b >= 0x20 && index < len); int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); lat += dlat; @@ -111,7 +111,7 @@ std::vector decodePolyline(const std::string &geometry_string) b = geometry_string.at(index++) - 63; result |= (b & 0x1f) << shift; shift += 5; - } while (b >= 0x20); + } while (b >= 0x20 && index < len); int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); lng += dlng;