diff options
author | Gennadiy Civil <gennadiycivil@users.noreply.github.com> | 2019-02-20 13:04:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-20 13:04:20 -0500 |
commit | 6d4d2f06bebcbaa36a60d7d1c6934efbfaf2db95 (patch) | |
tree | 9af7dff24601f513b2dd30d4cbb6a6a511246d51 | |
parent | d850e144710e330070b756c009749dc7a7302301 (diff) | |
parent | 9dc235b59cfde0edf3e2a5b1dea32483c99c4ac4 (diff) | |
download | googletest-6d4d2f06bebcbaa36a60d7d1c6934efbfaf2db95.tar.gz googletest-6d4d2f06bebcbaa36a60d7d1c6934efbfaf2db95.tar.bz2 googletest-6d4d2f06bebcbaa36a60d7d1c6934efbfaf2db95.zip |
Merge pull request #2141 from dspinellis/index-fix
Avoid array index out of range
-rw-r--r-- | googletest/docs/primer.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/googletest/docs/primer.md b/googletest/docs/primer.md index 6344ba33..1d995574 100644 --- a/googletest/docs/primer.md +++ b/googletest/docs/primer.md @@ -122,7 +122,7 @@ To provide a custom failure message, simply stream it into the macro using the ```c++ ASSERT_EQ(x.size(), y.size()) << "Vectors x and y are of unequal length"; -for (int i = 0; i < x.size(); ++i) { +for (int i = 0; i < std::min(x.size(), y.size()); ++i) { EXPECT_EQ(x[i], y[i]) << "Vectors x and y differ at index " << i; } ``` |