Skip to content

Commit

Permalink
Add length guard to fix Windows build with VS2019 16.11.7 headers (#3…
Browse files Browse the repository at this point in the history
…0189)

The shell tests are failing on Windows against the latest VS2019 headers due to a new safety assert.
  • Loading branch information
bdero committed Dec 7, 2021
1 parent 8796f0f commit c1e235d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion shell/common/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit c1e235d

Please sign in to comment.