msvcp90: Fix off by one issue in basic_string::rfind.

This commit is contained in:
Piotr Caban 2015-06-09 13:49:54 +02:00 committed by Alexandre Julliard
parent 4f15cc4d1a
commit a0e8d62a8e
2 changed files with 8 additions and 8 deletions

View File

@ -989,8 +989,8 @@ MSVCP_size_t __thiscall MSVCP_basic_string_char_rfind_cstr_substr(
if(len > this->size)
return MSVCP_basic_string_char_npos;
if(pos > this->size-len+1)
pos = this->size-len+1;
if(pos > this->size-len)
pos = this->size-len;
end = this->ptr;
for(p=end+pos; p>=end; p--) {
if(*p==*find && !MSVCP_char_traits_char_compare(p, find, len))
@ -2512,8 +2512,8 @@ MSVCP_size_t __thiscall MSVCP_basic_string_wchar_rfind_cstr_substr(
if(len > this->size)
return MSVCP_basic_string_wchar_npos;
if(pos > this->size-len+1)
pos = this->size-len+1;
if(pos > this->size-len)
pos = this->size-len;
end = this->ptr;
for(p=end+pos; p>=end; p--) {
if(*p==*find && !MSVCP_char_traits_wchar_compare(p, find, len))

View File

@ -1542,8 +1542,8 @@ MSVCP_size_t __thiscall MSVCP_basic_string_char_rfind_cstr_substr(
if(len > this->size)
return MSVCP_basic_string_char_npos;
if(pos > this->size-len+1)
pos = this->size-len+1;
if(pos > this->size-len)
pos = this->size-len;
end = basic_string_char_const_ptr(this);
for(p=end+pos; p>=end; p--) {
if(*p==*find && !MSVCP_char_traits_char_compare(p, find, len))
@ -3392,8 +3392,8 @@ MSVCP_size_t __thiscall MSVCP_basic_string_wchar_rfind_cstr_substr(
if(len > this->size)
return MSVCP_basic_string_wchar_npos;
if(pos > this->size-len+1)
pos = this->size-len+1;
if(pos > this->size-len)
pos = this->size-len;
end = basic_string_wchar_const_ptr(this);
for(p=end+pos; p>=end; p--) {
if(*p==*find && !MSVCP_char_traits_wchar_compare(p, find, len))