regex.h (regex_traits<>::transform_primary): Avoid past-the-end dereferences.
2013-08-16 Tim Shen <timshen91@gmail.com> * include/bits/regex.h (regex_traits<>::transform_primary): Avoid past-the-end dereferences. From-SVN: r201783
This commit is contained in:
parent
639dc669ec
commit
5073d50905
|
@ -1,3 +1,8 @@
|
||||||
|
2013-08-16 Tim Shen <timshen91@gmail.com>
|
||||||
|
|
||||||
|
* include/bits/regex.h (regex_traits<>::transform_primary):
|
||||||
|
Avoid past-the-end dereferences.
|
||||||
|
|
||||||
2013-08-14 Paolo Carlini <paolo.carlini@oracle.com>
|
2013-08-14 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
PR libstdc++/58163
|
PR libstdc++/58163
|
||||||
|
|
|
@ -220,19 +220,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
string_type
|
string_type
|
||||||
transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
|
transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
|
||||||
{
|
{
|
||||||
__try
|
typedef std::ctype<char_type> __ctype_type;
|
||||||
{
|
const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
|
||||||
typedef std::ctype<char_type> __ctype_type;
|
std::vector<char_type> __s(__first, __last);
|
||||||
const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
|
// FIXME : this is not entirely correct
|
||||||
std::vector<char_type> __v(__first, __last);
|
__fctyp.tolower(__s.data(), __s.data() + __s.size());
|
||||||
// FIXME : this is not entirely correct
|
return this->transform(__s.data(), __s.data() + __s.size());
|
||||||
__fctyp.tolower(&*__v.begin(), &*__v.end());
|
|
||||||
return this->transform(&*__v.begin(), &*__v.end());
|
|
||||||
}
|
|
||||||
__catch (std::bad_cast)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
return string_type();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -572,7 +565,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
|
|
||||||
std::string __s(__last - __first, '?');
|
std::string __s(__last - __first, '?');
|
||||||
__fctyp.narrow(__first, __last, '?', &__s[0]);
|
__fctyp.narrow(__first, __last, '?', &__s[0]);
|
||||||
__cctyp.tolower(&*__s.begin(), &*__s.end());
|
__cctyp.tolower(&*__s.begin(), &*__s.begin() + __s.size());
|
||||||
for (_ClassnameEntry* __it = __classnames;
|
for (_ClassnameEntry* __it = __classnames;
|
||||||
__it < *(&__classnames + 1);
|
__it < *(&__classnames + 1);
|
||||||
++__it)
|
++__it)
|
||||||
|
|
Loading…
Reference in New Issue