From f53143f1a1018050a2104f9afd929c963951527d Mon Sep 17 00:00:00 2001 From: zmiao Date: Thu, 5 Sep 2019 11:08:21 +0300 Subject: [core] Fix Integer overflow when converting tileCoordinates to LatLon (#15560) * [core] fix integer overflow * [core] Add change log --- platform/android/CHANGELOG.md | 6 ++++-- platform/ios/CHANGELOG.md | 1 + platform/macos/CHANGELOG.md | 1 + platform/node/CHANGELOG.md | 1 + src/mbgl/tile/geometry_tile_data.cpp | 4 ++-- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index 982ab23c06..10da503a48 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -3,7 +3,9 @@ Mapbox welcomes participation and contributions from everyone. If you'd like to do so please see the [`Contributing Guide`](https://github.com/mapbox/mapbox-gl-native/blob/master/CONTRIBUTING.md) first to get started. ## master - +### Bug fixes + - Fixed an issue of integer overflow when converting `tileCoordinates` to `LatLon`. [#15560](https://github.com/mapbox/mapbox-gl-native/pull/15560) + ## 8.4.0-alpha.1 - September 4, 2019 [Changes](https://github.com/mapbox/mapbox-gl-native/compare/android-v8.3.0...android-v8.4.0-alpha.1) since [Mapbox Maps SDK for Android v8.3.0](https://github.com/mapbox/mapbox-gl-native/releases/tag/android-v8.3.0): @@ -14,7 +16,7 @@ Mapbox welcomes participation and contributions from everyone. If you'd like to - Enable using of `text-offset` option together with `text-variable-anchor` (if `text-radial-offset` option is not provided). If used with `text-variable-anchor`, input values will be taken as absolute values. Offsets along the x- and y-axis will be applied automatically based on the anchor position. [#15542](https://github.com/mapbox/mapbox-gl-native/pull/15542) ### Bug fixes - - Fixed a rendering issue of `collisionBox` when `text-translate` or `icon-translate` is enabled. [#15467](https://github.com/mapbox/mapbox-gl-native/pull/15467) +- Fixed a rendering issue of `collisionBox` when `text-translate` or `icon-translate` is enabled. [#15467](https://github.com/mapbox/mapbox-gl-native/pull/15467) - Fixed unnecessary layers blink when the same components are re-added after the style reload [#15513](https://github.com/mapbox/mapbox-gl-native/pull/15513) - Fixed an issue in JNI marshaling code that converted a float to long that produced invalid expressions [#15557](https://github.com/mapbox/mapbox-gl-native/pull/15557) - Call callback onFinish() immediately when trying to move camera to current position [#15558](https://github.com/mapbox/mapbox-gl-native/pull/15558) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 2132be5077..94ca9b37f1 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -11,6 +11,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Enabled use of `MGLSymbolStyleLayer.textOffset` option together with `MGLSymbolStyleLayer.textVariableAnchor` (if `MGLSymbolStyleLayer.textRadialOffset` option is not provided). ([#15542](https://github.com/mapbox/mapbox-gl-native/pull/15542)) * Fixed an issue with the appearance of the compass text in iOS 13. ([#15547](https://github.com/mapbox/mapbox-gl-native/pull/15547)) * Fixed a bug where the completion block passed to `-[MGLMapView flyToCamera:completionHandler:` (and related methods) wouldn't be called. ([#15473](https://github.com/mapbox/mapbox-gl-native/pull/15473)) +* Fixed an issue of integer overflow when converting `tileCoordinates` to `LatLon`. ([#15560](https://github.com/mapbox/mapbox-gl-native/pull/15560)) ### Performance improvements diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index bd1a84a495..dc20a7e010 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -15,6 +15,7 @@ * Fixed symbol overlap when zooming out quickly. ([15416](https://github.com/mapbox/mapbox-gl-native/pull/15416)) * Fixed a rendering issue that non-SDF icon would be treated as SDF icon if they are in the same layer. ([#15456](https://github.com/mapbox/mapbox-gl-native/pull/15456)) * Fixed a rendering issue of `collisionBox` when `text-translate` or `icon-translate` is enabled. ([#15467](https://github.com/mapbox/mapbox-gl-native/pull/15467)) +* Fixed an issue of integer overflow when converting `tileCoordinates` to `LatLon`. ([#15560](https://github.com/mapbox/mapbox-gl-native/pull/15560)) ### Styles and rendering diff --git a/platform/node/CHANGELOG.md b/platform/node/CHANGELOG.md index 43b18208b4..7a1ef4f1d7 100644 --- a/platform/node/CHANGELOG.md +++ b/platform/node/CHANGELOG.md @@ -3,6 +3,7 @@ * Fixed rendering and collision detection issues with using `text-variable-anchor` and `icon-text-fit` properties on the same layer ([#15367](https://github.com/mapbox/mapbox-gl-native/pull/15367)). * Fixed a rendering issue that non-SDF icon would be treated as SDF icon if they are in the same layer. ([#15456](https://github.com/mapbox/mapbox-gl-native/pull/15456)) * Fixed a rendering issue of `collisionBox` when `text-translate` or `icon-translate` is enabled. ([#15467](https://github.com/mapbox/mapbox-gl-native/pull/15467)) +* Fixed an issue of integer overflow when converting `tileCoordinates` to `LatLon`. ([#15560](https://github.com/mapbox/mapbox-gl-native/pull/15560)) # 4.2.0 - Add an option to set whether or not an image should be treated as a SDF ([#15054](https://github.com/mapbox/mapbox-gl-native/issues/15054)) diff --git a/src/mbgl/tile/geometry_tile_data.cpp b/src/mbgl/tile/geometry_tile_data.cpp index adbcd6c599..f723a94800 100644 --- a/src/mbgl/tile/geometry_tile_data.cpp +++ b/src/mbgl/tile/geometry_tile_data.cpp @@ -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(tileID.x); + const double y0 = util::EXTENT * static_cast(tileID.y); auto tileCoordinatesToLatLng = [&] (const Point& p) { double y2 = 180 - (p.y + y0) * 360 / size; -- cgit v1.2.1