diff options
author | Luke Chen <luke.chen@mongodb.com> | 2021-10-18 14:00:21 +1100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-18 03:23:58 +0000 |
commit | 88cc2a1a8342e8042a583020fcd16d4d77d11b60 (patch) | |
tree | 7b6e7511a7c11d029d4cb0892b919623fa0b184e /src | |
parent | fbc4eac4b2ce2a672977ed07fbe20e146ee36148 (diff) | |
download | mongo-88cc2a1a8342e8042a583020fcd16d4d77d11b60.tar.gz |
Import wiredtiger: cc95b23b1494b2cab4a40b254cfebc1d428e5503 from branch mongodb-5.1
ref: e271f9d668..cc95b23b14
for: 5.1.0-rc1
WT-8147 Detect invalid syntax in cppsuite configs
Diffstat (limited to 'src')
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/test_harness/core/configuration.cxx | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 6e23c5dfe7d..da1a40d2ad1 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-5.1", - "commit": "e271f9d668abe181367adcba829eace0c74d8b07" + "commit": "cc95b23b1494b2cab4a40b254cfebc1d428e5503" } diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/configuration.cxx b/src/third_party/wiredtiger/test/cppsuite/test_harness/core/configuration.cxx index b6c53397955..3a785f395ad 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/configuration.cxx +++ b/src/third_party/wiredtiger/test/cppsuite/test_harness/core/configuration.cxx @@ -258,6 +258,14 @@ configuration::split_config(const std::string &config) in_subconfig = !parens.empty(); } if (cut_config[i] == '=' && !in_subconfig) { + if (len == 0) { + testutil_die(EINVAL, "error parsing config: detected empty key"); + } + if (expect_value) { + testutil_die(EINVAL, + "error parsing config: syntax error parsing value for key ['%s']: '%s'", + key.c_str(), cut_config.substr(start, len).c_str()); + } expect_value = true; key = cut_config.substr(start, len); start += len + 1; @@ -265,6 +273,15 @@ configuration::split_config(const std::string &config) continue; } if (cut_config[i] == ',' && !in_subconfig) { + if (len == 0) { + testutil_die( + EINVAL, "error parsing config: detected empty value for key:'%s'", key.c_str()); + } + if (!expect_value) { + testutil_die(EINVAL, + "error parsing config: syntax error parsing key value pair: '%s'", + cut_config.substr(start, len).c_str()); + } expect_value = false; if (start + len >= cut_config.size()) break; |