StringRef no longer repoints m_start to m_data after c_str() on a substring.
This fixes an issue where a self-assignment of a StringRef copy would point into internally (and now dangling) data. (now self-assignment check is no longer needed)
This commit is contained in:
parent
71fce429af
commit
96355da34e
3 changed files with 10 additions and 11 deletions
|
@ -71,12 +71,12 @@ namespace Catch {
|
|||
}
|
||||
|
||||
auto operator = ( StringRef const &other ) noexcept -> StringRef& {
|
||||
if( this != &other ) {
|
||||
// if( this != &other ) {
|
||||
delete[] m_data;
|
||||
m_data = nullptr;
|
||||
m_start = other.m_start;
|
||||
m_size = other.m_size;
|
||||
}
|
||||
// }
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue