mirror of git://gcc.gnu.org/git/gcc.git
PR libstdc++/81173 fix undefined memset with null pointer
PR libstdc++/81173 * include/bits/stl_bvector.h (vector<bool>::_M_initialize_value): Do not pass null pointer to memset. From-SVN: r249554
This commit is contained in:
parent
0759db190d
commit
b6d03af0b1
|
|
@ -1,3 +1,9 @@
|
||||||
|
2017-06-22 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
PR libstdc++/81173
|
||||||
|
* include/bits/stl_bvector.h (vector<bool>::_M_initialize_value):
|
||||||
|
Do not pass null pointer to memset.
|
||||||
|
|
||||||
2017-06-21 Ville Voutilainen <ville.voutilainen@gmail.com>
|
2017-06-21 Ville Voutilainen <ville.voutilainen@gmail.com>
|
||||||
|
|
||||||
PR libstdc++/80675
|
PR libstdc++/80675
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
||||||
{
|
{
|
||||||
if (__first._M_p != __last._M_p)
|
if (__first._M_p != __last._M_p)
|
||||||
{
|
{
|
||||||
_Bit_type *__first_p = __first._M_p;
|
_Bit_type* __first_p = __first._M_p;
|
||||||
if (__first._M_offset != 0)
|
if (__first._M_offset != 0)
|
||||||
__fill_bvector(__first_p++, __first._M_offset, _S_word_bit, __x);
|
__fill_bvector(__first_p++, __first._M_offset, _S_word_bit, __x);
|
||||||
|
|
||||||
|
|
@ -1129,9 +1129,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
||||||
void
|
void
|
||||||
_M_initialize_value(bool __x)
|
_M_initialize_value(bool __x)
|
||||||
{
|
{
|
||||||
__builtin_memset(this->_M_impl._M_start._M_p, __x ? ~0 : 0,
|
if (_Bit_type* __p = this->_M_impl._M_start._M_p)
|
||||||
(this->_M_impl._M_end_addr() - this->_M_impl._M_start._M_p)
|
__builtin_memset(__p, __x ? ~0 : 0,
|
||||||
* sizeof(_Bit_type));
|
(this->_M_impl._M_end_addr() - __p)
|
||||||
|
* sizeof(_Bit_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue