aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-02-02 11:13:12 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-02-02 11:13:12 +0100
commit3ed6153400299db04163ffe8fd9fd785eb9ca12e (patch)
treebea0ff5310edad0033cd0635fe56a511e0a15909
parent81a2c053eecc3e6ce8a5926784b9aae0b88e7033 (diff)
downloadPROJ-3ed6153400299db04163ffe8fd9fd785eb9ca12e.tar.gz
PROJ-3ed6153400299db04163ffe8fd9fd785eb9ca12e.zip
createFromUserInput(): fix infinite recursion. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12842. Credit to OSS Fuzz
-rw-r--r--src/iso19111/io.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index f854e21a..1f4a7c8b 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -5287,6 +5287,7 @@ PROJStringSyntaxParser(const std::string &projString, std::vector<Step> &steps,
bool hasProj = false;
bool hasInit = false;
+ bool hasPipeline = false;
{
size_t i = 0;
while (true) {
@@ -5315,8 +5316,11 @@ PROJStringSyntaxParser(const std::string &projString, std::vector<Step> &steps,
if (token.empty()) {
break;
}
- if (!hasProj &&
- (starts_with(token, "proj=") || starts_with(token, "+proj="))) {
+ if (!hasPipeline &&
+ (token == "proj=pipeline" || token == "+proj=pipeline")) {
+ hasPipeline = true;
+ } else if (!hasProj && (starts_with(token, "proj=") ||
+ starts_with(token, "+proj="))) {
hasProj = true;
} else if (!hasInit && (starts_with(token, "init=") ||
starts_with(token, "+init="))) {
@@ -5328,7 +5332,7 @@ PROJStringSyntaxParser(const std::string &projString, std::vector<Step> &steps,
bool prevWasTitle = false;
- if (projString.find("proj=pipeline") == std::string::npos) {
+ if (!hasPipeline) {
if (hasProj || hasInit) {
steps.push_back(Step());
}