From 5ec04c0474622857d2428a49d98698320402d089 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 6 Apr 2015 11:51:31 -0700 Subject: [PATCH] Bounds-check array access at source --- src/mbgl/map/source.cpp | 2 +- src/mbgl/map/tile_data.cpp | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/mbgl/map/source.cpp b/src/mbgl/map/source.cpp index b6a941b26..282fd3093 100644 --- a/src/mbgl/map/source.cpp +++ b/src/mbgl/map/source.cpp @@ -97,7 +97,7 @@ void SourceInfo::parseTileJSONProperties(const rapidjson::Value& value) { } std::string SourceInfo::tileURL(const Tile::ID& id, float pixelRatio) const { - std::string result = tiles[(id.x + id.y) % tiles.size()]; + std::string result = tiles.at((id.x + id.y) % tiles.size()); result = util::mapbox::normalizeTileURL(result, url, type); result = util::replaceTokens(result, [&](const std::string &token) -> std::string { if (token == "z") return util::toString(id.z); diff --git a/src/mbgl/map/tile_data.cpp b/src/mbgl/map/tile_data.cpp index 2675c0644..a2e485a24 100644 --- a/src/mbgl/map/tile_data.cpp +++ b/src/mbgl/map/tile_data.cpp @@ -30,9 +30,6 @@ const std::string TileData::toString() const { } void TileData::request(uv::worker &worker, float pixelRatio, std::function callback) { - if (source.tiles.empty()) - return; - std::string url = source.tileURL(id, pixelRatio); state = State::loading;