From cb82a98bf61b71e027b52ea1c0de13bd4d7b2bcb Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Tue, 21 Jun 2016 17:44:21 +0300 Subject: [PATCH] Fix incorrect size check in entity search algorithms. --- source/Base/Algo.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/Base/Algo.hpp b/source/Base/Algo.hpp index 949d46e9..bcb9f8d0 100644 --- a/source/Base/Algo.hpp +++ b/source/Base/Algo.hpp @@ -65,7 +65,7 @@ void EachBegins(Iterator first, Iterator last, // Retrieve the string const auto & s = retrieve(*first); // Compare the string - if (s.size() > len && (s.compare(0, len, str) == 0) == neg) + if (s.size() >= len && (s.compare(0, len, str) == 0) == neg) { collect(*first); } @@ -90,7 +90,7 @@ void EachEnds(Iterator first, Iterator last, // Retrieve the string const auto & s = retrieve(*first); // Compare the tag - if (s.size() > len && (s.compare(s.size() - len, len, str) == 0) == neg) + if (s.size() >= len && (s.compare(s.size() - len, len, str) == 0) == neg) { collect(*first); } @@ -151,7 +151,7 @@ void FirstBegins(Iterator first, Iterator last, // Retrieve the string const auto & s = retrieve(*first); // Compare the string - if (s.size() > len && (s.compare(0, len, str) == 0) == neg) + if (s.size() >= len && (s.compare(0, len, str) == 0) == neg) { receive(*first); break; @@ -177,7 +177,7 @@ void FirstEnds(Iterator first, Iterator last, // Retrieve the string const auto & s = retrieve(*first); // Compare the string - if (s.size() > len && (s.compare(s.size() - len, len, str) == 0) == neg) + if (s.size() >= len && (s.compare(s.size() - len, len, str) == 0) == neg) { receive(*first); break;