diff options
author | Paul Pluzhnikov <ppluzhnikov@google.com> | 2013-05-31 01:56:20 +0000 |
---|---|---|
committer | Paul Pluzhnikov <ppluzhnikov@google.com> | 2013-05-31 01:56:20 +0000 |
commit | 61f09f6ec6b035c4d659b091de4d6d325d3c0fa6 (patch) | |
tree | 8a0e4c7efb4997be1c70e30cf56ca9848e2067c9 | |
parent | 011821c91cbcefae12203eb0d621f387f316ce65 (diff) |
Relax vector validity checks to accomodate ABI-compatible code built with
earlier releases. Google ref: b/9198806.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/google/integration@199467 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libstdc++-v3/include/bits/stl_vector.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 9a53f3ebe93..164a1111c77 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -246,12 +246,27 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER bool _M_is_valid() const { - return (this->_M_impl._M_end_of_storage == 0 - && this->_M_impl._M_start == 0 - && this->_M_impl._M_finish == 0) - || (this->_M_impl._M_start <= this->_M_impl._M_finish - && this->_M_impl._M_finish <= this->_M_impl._M_end_of_storage - && this->_M_impl._M_start < this->_M_impl._M_end_of_storage); + if (this->_M_impl._M_end_of_storage == 0 + && this->_M_impl._M_start == 0 + && this->_M_impl._M_finish == 0) + return true; + + if (this->_M_impl._M_start <= this->_M_impl._M_finish + && this->_M_impl._M_finish <= this->_M_impl._M_end_of_storage) + { + if (this->_M_impl._M_start < this->_M_impl._M_end_of_storage) + return true; + else if (this->_M_impl._M_start == this->_M_impl._M_end_of_storage + && this->_M_impl._M_start == this->_M_impl._M_finish) + { + pointer _0xcdcd; + + __builtin_memset(&_0xcdcd, 0xcd, sizeof(_0xcdcd)); + return this->_M_impl._M_finish != _0xcdcd; + } + } + + return false; } public: |