From 46e2f13e683048ea206110cb2b6f0af36db2782f Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Fri, 23 Oct 2015 11:00:24 -0700 Subject: [PATCH] [core] Fix integer overflow for high maximum zoom levels --- src/mbgl/annotation/shape_annotation_impl.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp index 4ab9958fd..4f1863874 100644 --- a/src/mbgl/annotation/shape_annotation_impl.cpp +++ b/src/mbgl/annotation/shape_annotation_impl.cpp @@ -96,10 +96,12 @@ std::unique_ptr ShapeAnnotationImpl::createFillLayer() { } void ShapeAnnotationImpl::updateTile(const TileID& tileID, AnnotationTile& tile) { + static const double baseTolerance = 3; + static const uint16_t extent = 4096; + if (!shapeTiler) { - const double baseTolerance = 3; - const uint16_t extent = 4096; - const double tolerance = baseTolerance / ((1 << maxZoom) * extent); + const uint64_t maxAmountOfTiles = 1 << maxZoom; + const double tolerance = baseTolerance / (maxAmountOfTiles * extent); ProjectedGeometryContainer rings; std::vector points;