diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-07-19 16:01:24 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-07-19 16:01:24 +0200 |
commit | 559f3a654b976d41d0f3db3fa958ebcda3e97b1c (patch) | |
tree | 99853c1b2c19adeb1d3f3bfeb84910abe0fb6d47 /src | |
parent | 1bc4f0e0273d6be24de56512fd52a147ea74f9e1 (diff) | |
download | qtlocation-mapboxgl-559f3a654b976d41d0f3db3fa958ebcda3e97b1c.tar.gz |
[core] add check for missing sprite URL file extension
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/util/mapbox.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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); } |