From d640c2215f7dc47f4d55d2c0c1da867849761e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 19 Jul 2016 16:01:24 +0200 Subject: [core] add check for missing sprite URL file extension Cherry-picked from 559f3a654b976d41d0f3db3fa958ebcda3e97b1c. --- src/mbgl/util/mapbox.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/mbgl/util/mapbox.cpp b/src/mbgl/util/mapbox.cpp index 97c28c0aeb..28dedaf25c 100644 --- a/src/mbgl/util/mapbox.cpp +++ b/src/mbgl/util/mapbox.cpp @@ -83,10 +83,18 @@ std::string normalizeSpriteURL(const std::string& url, const std::string& access std::string id, extension; if (isDraft) { size_t index = pathname[3].find_first_of("@."); + if (index == std::string::npos) { + Log::Error(Event::ParseStyle, "Invalid sprite URL"); + return url; + } id = pathname[2]; extension = pathname[3].substr(index); } else { size_t index = pathname[2].find_first_of("@."); + if (index == std::string::npos) { + Log::Error(Event::ParseStyle, "Invalid sprite URL"); + return url; + } id = pathname[2].substr(0, index); extension = pathname[2].substr(index); } -- cgit v1.2.1