Fix string_view not checking for oversized needles during in search function
This commit is contained in:
parent
0ac55f3699
commit
13ce1550e2
@ -51,6 +51,9 @@ namespace rexy{
|
|||||||
|
|
||||||
template<class Char>
|
template<class Char>
|
||||||
constexpr auto basic_string_view<Char>::search(basic_string_view s)const -> const_iterator{
|
constexpr auto basic_string_view<Char>::search(basic_string_view s)const -> const_iterator{
|
||||||
|
if(s.length() > m_length){
|
||||||
|
return cend();
|
||||||
|
}
|
||||||
return two_way_search(cbegin(), cend(), s.cbegin(), s.cend());
|
return two_way_search(cbegin(), cend(), s.cbegin(), s.cend());
|
||||||
}
|
}
|
||||||
template<class Char>
|
template<class Char>
|
||||||
@ -61,6 +64,9 @@ namespace rexy{
|
|||||||
template<class Char>
|
template<class Char>
|
||||||
template<class Searcher>
|
template<class Searcher>
|
||||||
constexpr auto basic_string_view<Char>::search(basic_string_view s, const Searcher& searcher)const -> const_iterator{
|
constexpr auto basic_string_view<Char>::search(basic_string_view s, const Searcher& searcher)const -> const_iterator{
|
||||||
|
if(s.length() > m_length){
|
||||||
|
return cend();
|
||||||
|
}
|
||||||
return searcher(cbegin(), cend(), s.cbegin(), s.cend());
|
return searcher(cbegin(), cend(), s.cbegin(), s.cend());
|
||||||
}
|
}
|
||||||
template<class Char>
|
template<class Char>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user