From f59eb822e12b54f74e688a138dc8f4ede1feade8 Mon Sep 17 00:00:00 2001 From: Anand Thakker Date: Fri, 9 Jun 2017 06:28:14 -0400 Subject: Fix undefined memory access in getCoveringRanges() (#9227) * Add simple unit tests for SymbolSizeBinder * Fix bug in symbol size uniform value calculation For camera functions we were setting the zoom levels in "covering ranges" to `[(zoom stop <= tile zoom), (zoom stop >= 1 + tile zoom)]`, but then evaluating the function at `[tile_zoom, tile_zoom + 1]`. * Check for it != end() before accessing it->first --- include/mbgl/style/function/composite_function.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/mbgl/style/function/composite_function.hpp') diff --git a/include/mbgl/style/function/composite_function.hpp b/include/mbgl/style/function/composite_function.hpp index 9275ccdf8f..1b785f4670 100644 --- a/include/mbgl/style/function/composite_function.hpp +++ b/include/mbgl/style/function/composite_function.hpp @@ -59,7 +59,7 @@ public: // lower_bound yields first element >= zoom, but we want the *last* // element <= zoom, so if we found a stop > zoom, back up by one. - if (minIt != s.stops.begin() && minIt->first > zoom) { + if (minIt != s.stops.begin() && minIt != s.stops.end() && minIt->first > zoom) { minIt--; } -- cgit v1.2.1