fix argv accessed out of bounds in ParseCommandLineFlags() (#321)

This commit is contained in:
Niklas Rosenstein 2016-12-06 17:38:03 +01:00 committed by Dominic Hamon
parent efd4e992a6
commit 56336e70f1

View File

@ -634,7 +634,7 @@ void ParseCommandLineFlags(int* argc, char** argv) {
// TODO: Remove this.
ParseStringFlag(argv[i], "color_print", &FLAGS_benchmark_color) ||
ParseInt32Flag(argv[i], "v", &FLAGS_v)) {
for (int j = i; j != *argc; ++j) argv[j] = argv[j + 1];
for (int j = i; j != *argc - 1; ++j) argv[j] = argv[j + 1];
--(*argc);
--i;