[core] Fix Integer overflow when converting tileCoordinates to LatLon (#15560)

* [core] fix integer overflow

* [core] Add change log
This commit is contained in:
zmiao
2019-09-05 11:08:21 +03:00
committed by GitHub
parent 96581fd3ff
commit f53143f1a1
5 changed files with 9 additions and 4 deletions

View File

@@ -101,8 +101,8 @@ void limitHoles(GeometryCollection& polygon, uint32_t maxHoles) {
static Feature::geometry_type convertGeometry(const GeometryTileFeature& geometryTileFeature, const CanonicalTileID& tileID) {
const double size = util::EXTENT * std::pow(2, tileID.z);
const double x0 = util::EXTENT * tileID.x;
const double y0 = util::EXTENT * tileID.y;
const double x0 = util::EXTENT * static_cast<double>(tileID.x);
const double y0 = util::EXTENT * static_cast<double>(tileID.y);
auto tileCoordinatesToLatLng = [&] (const Point<int16_t>& p) {
double y2 = 180 - (p.y + y0) * 360 / size;