From 0539f7b4cb49e0690b9654f57fe9e2f724e14903 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Tue, 29 Mar 2016 00:23:16 -0700 Subject: [PATCH] [core] fix infinite loop in mbgl::resample fix #4416 --- package.json | 2 +- src/mbgl/renderer/line_bucket.cpp | 2 +- src/mbgl/renderer/symbol_bucket.cpp | 2 +- src/mbgl/text/get_anchors.cpp | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3c561c21b02..61e54ab7bcb 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "devDependencies": { "aws-sdk": "^2.2.21", - "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#a42cd0cb818356d91fc6b61e2b64801e57486ac0", + "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#45066f6e78c780211d9587df2352597e07a197b5", "node-gyp": "^3.2.1", "request": "^2.67.0", "tape": "^4.2.2" diff --git a/src/mbgl/renderer/line_bucket.cpp b/src/mbgl/renderer/line_bucket.cpp index ac9a3f7231f..dfaa93419c5 100644 --- a/src/mbgl/renderer/line_bucket.cpp +++ b/src/mbgl/renderer/line_bucket.cpp @@ -69,7 +69,7 @@ void LineBucket::addGeometry(const GeometryCoordinates& vertices) { const float miterLimit = layout.join == JoinType::Bevel ? 1.05f : float(layout.miterLimit); - const double sharpCornerOffset = SHARP_CORNER_OFFSET * (util::EXTENT / (util::tileSize * overscaling)); + const double sharpCornerOffset = SHARP_CORNER_OFFSET * (float(util::EXTENT) / (util::tileSize * overscaling)); const GeometryCoordinate firstVertex = vertices.front(); const GeometryCoordinate lastVertex = vertices[len - 1]; diff --git a/src/mbgl/renderer/symbol_bucket.cpp b/src/mbgl/renderer/symbol_bucket.cpp index 404a62d374a..6530510e27f 100644 --- a/src/mbgl/renderer/symbol_bucket.cpp +++ b/src/mbgl/renderer/symbol_bucket.cpp @@ -60,7 +60,7 @@ SymbolBucket::SymbolBucket(uint32_t overscaling_, float zoom_, const MapMode mod : overscaling(overscaling_), zoom(zoom_), tileSize(util::tileSize * overscaling_), - tilePixelRatio(util::EXTENT / tileSize), + tilePixelRatio(float(util::EXTENT) / tileSize), mode(mode_) {} SymbolBucket::~SymbolBucket() { diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp index 740ec288b3e..c55f238e528 100644 --- a/src/mbgl/text/get_anchors.cpp +++ b/src/mbgl/text/get_anchors.cpp @@ -3,6 +3,7 @@ #include #include +#include #include namespace mbgl { @@ -21,6 +22,8 @@ Anchors resample(const GeometryCoordinates &line, const float offset, const floa Anchors anchors; + assert(spacing > 0.0); + int i = 0; for (auto it = line.begin(), end = line.end() - 1; it != end; it++, i++) { const GeometryCoordinate &a = *(it);