From 9d4101767569beb6f7cbaa63849ab38dc0e2dcc3 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Mon, 14 Aug 2023 15:31:36 -0700 Subject: [PATCH] Fix tr1/algorithm These two `is_permutation(first, last, x)` calls violate the precondition that `[x, x + (last - first))` is a valid range. Fixes VSO-1854237 / AB#1854237 --- tests/tr1/tests/algorithm/test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tr1/tests/algorithm/test.cpp b/tests/tr1/tests/algorithm/test.cpp index 8a0d2d339a..78683be089 100644 --- a/tests/tr1/tests/algorithm/test.cpp +++ b/tests/tr1/tests/algorithm/test.cpp @@ -105,8 +105,8 @@ void test_find(char* first, char* last) { // test searching template functions CHECK(STD is_permutation(first, last, p1, p1 + 7)); CHECK(!STD is_permutation(first, last, p1, p1 + CSTD strlen(p1))); const char* p2 = "abcgfedxx"; - CHECK(!STD is_permutation(first, last, p2 + 7)); - CHECK(!STD is_permutation(first, last, p2 + CSTD strlen(p2))); + CHECK(!STD is_permutation(first, last, p2, p2 + 7)); + CHECK(!STD is_permutation(first, last, p2, p2 + CSTD strlen(p2))); CHECK(STD is_permutation(first, last, first, last, &cmp_chars)); const char* p3 = "aBCgfecxx";