summaryrefslogtreecommitdiff
path: root/src/mbgl/style/conversion/filter.cpp
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2019-08-15 23:01:51 +0300
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2019-08-15 23:01:51 +0300
commit81113de9d1c787a66f0e1fecb141e2b8936d45e9 (patch)
treee744d4a1639057095d4712be216ada001d9a9ed8 /src/mbgl/style/conversion/filter.cpp
parent1cb30268d7d0581bb1964cc7ccd310153ca50fca (diff)
downloadqtlocation-mapboxgl-upstream/alexshalamov_fix_15388.tar.gz
[core] Check type of a convertible value when constructing legacy filterupstream/alexshalamov_fix_15388
Diffstat (limited to 'src/mbgl/style/conversion/filter.cpp')
-rw-r--r--src/mbgl/style/conversion/filter.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mbgl/style/conversion/filter.cpp b/src/mbgl/style/conversion/filter.cpp
index 4e8d9c48e5..1b77985322 100644
--- a/src/mbgl/style/conversion/filter.cpp
+++ b/src/mbgl/style/conversion/filter.cpp
@@ -195,11 +195,16 @@ ParseResult convertLegacyFilter(const Convertible& values, Error& error) {
return {std::make_unique<Literal>(true)};
}
+ if (!isArray(values) || arrayLength(values) == 0) {
+ error.message = "filter value must be a non empty array";
+ return nullopt;
+ }
+
optional<std::string> op = toString(arrayMember(values, 0));
if (!op) {
error.message = "filter operator must be a string";
- return {};
+ return nullopt;
} else if (arrayLength(values) <= 1) {
return {std::make_unique<Literal>(*op != "any")};
} else {