Skip to content

<xstring>: Fix basic_string::operator=(const&) thoroughly #3997

Description

@achabense

basic_string::operator=(const&) is still problematic even after #3862. For example:

STL/stl/inc/xstring

Lines 3170 to 3175 in 60f1885

_Traits::copy(_Unfancy(_New_ptr), _Right_ptr, _Right_size + 1);
_Tidy_deallocate();
_Mypair._Myval2._Bx._Ptr = _New_ptr;
_Mypair._Myval2._Mysize = _Right_size;
_Mypair._Myval2._Myres = _New_capacity;
} else {

  1. After _Tidy_deallocate the string is left in SSO mode, so the pointer should be constructed instead of assigned.
  2. The new allocation lacks ASAN annotation.

These are what I can find. As the branch is in such a broken state, I'm uncertain whether there are other problems.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedSomething works now, yay!

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions