Re: [patch] libstdc++/61086 - fix ubsan errors in std::vector

2014-05-07 Thread Paolo Carlini
Hi, On 05/07/2014 02:33 PM, Jonathan Wakely wrote: Yes, I checked. deque::const_iterator, list::const_iterator, vector::const_iterator and the _Rb_tree_const_iterator types all have _M_const_cast but they do not dereference anything. It only really affected std::vector because that's the only

Re: [patch] libstdc++/61086 - fix ubsan errors in std::vector

2014-05-07 Thread Jonathan Wakely
On 07/05/14 14:21 +0200, Paolo Carlini wrote: On 05/07/2014 02:07 PM, Jonathan Wakely wrote: The testcase in the PR calls __position._M_const_cast() to get a mutable iterator and that dereferences the pointer as suggested in http://gcc.gnu.org/ml/libstdc++/2013-05/msg00031.html That's invalid b

Re: [patch] libstdc++/61086 - fix ubsan errors in std::vector

2014-05-07 Thread Paolo Carlini
On 05/07/2014 02:07 PM, Jonathan Wakely wrote: The testcase in the PR calls __position._M_const_cast() to get a mutable iterator and that dereferences the pointer as suggested in http://gcc.gnu.org/ml/libstdc++/2013-05/msg00031.html That's invalid because the pointer is not dereferenceable (in t

[patch] libstdc++/61086 - fix ubsan errors in std::vector

2014-05-07 Thread Jonathan Wakely
The testcase in the PR calls __position._M_const_cast() to get a mutable iterator and that dereferences the pointer as suggested in http://gcc.gnu.org/ml/libstdc++/2013-05/msg00031.html That's invalid because the pointer is not dereferenceable (in this case it's null but is past-the-end at all tim