re PR libstdc++/7961 (compare( char *) implemented incorrectly.)
2002-11-01 John Carter <john.carter@tait.co.nz> PR libstdc++/7961 * include/bits/basic_string.tcc (compare(const _CharT* __s)): Don't access __s past its length. From-SVN: r58717
This commit is contained in:
parent
d5db54a12c
commit
c86c54e6d1
2 changed files with 10 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2002-11-01 John Carter <john.carter@tait.co.nz>
|
||||||
|
|
||||||
|
PR libstdc++/7961
|
||||||
|
* include/bits/basic_string.tcc
|
||||||
|
(compare(const _CharT* __s)): Don't access __s past its length.
|
||||||
|
|
||||||
2002-10-31 Benjamin Kosnik <bkoz@redhat.com>
|
2002-10-31 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
PR libstdc++/8348
|
PR libstdc++/8348
|
||||||
|
|
|
@ -884,9 +884,11 @@ namespace std
|
||||||
compare(const _CharT* __s) const
|
compare(const _CharT* __s) const
|
||||||
{
|
{
|
||||||
size_type __size = this->size();
|
size_type __size = this->size();
|
||||||
int __r = traits_type::compare(_M_data(), __s, __size);
|
size_type __osize = traits_type::length(__s);
|
||||||
|
size_type __len = min(__size, __osize);
|
||||||
|
int __r = traits_type::compare(_M_data(), __s, __len);
|
||||||
if (!__r)
|
if (!__r)
|
||||||
__r = __size - traits_type::length(__s);
|
__r = __size - __osize;
|
||||||
return __r;
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue