From e0d8a765fd49d31b7924ed78ccc2ac10ed357e97 Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Tue, 7 Dec 2021 11:13:52 -0800 Subject: [PATCH] Add length guard to fix Windows build with VS2019 16.11.7 headers The shell tests are failing on Windows against the latest VS2019 headers due to a new safety assert. --- shell/common/switches.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 38d4ece83a2fc..8b831b650e672 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -171,7 +171,8 @@ static bool IsAllowedDartVMFlag(const std::string& flag) { // Check that the prefix of the flag matches one of the allowed flags. // We don't need to worry about cases like "--safe --sneaky_dangerous" as // the VM will discard these as a single unrecognized flag. - if (std::equal(allowed.begin(), allowed.end(), flag.begin())) { + if (flag.length() >= allowed.length() && + std::equal(allowed.begin(), allowed.end(), flag.begin())) { return true; } }