diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-07-19 16:01:24 +0200 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-07-19 12:22:54 -0700 |
commit | d640c2215f7dc47f4d55d2c0c1da867849761e2a (patch) | |
tree | ac821efa6dff2dbbe8d53dffc8de139416deebb7 /src | |
parent | 12b431ee03b09643643be88da439283d873a6694 (diff) | |
download | qtlocation-mapboxgl-d640c2215f7dc47f4d55d2c0c1da867849761e2a.tar.gz |
[core] add check for missing sprite URL file extension
Cherry-picked from 559f3a654b976d41d0f3db3fa958ebcda3e97b1c.
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); } |