From f6fde1723d375f2879b366673330fa045faf73d3 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Sat, 4 Mar 2017 11:30:07 +0200 Subject: [PATCH] Fix idStr self-assignment Was calling memcpy with overlapping parameters which is inefficient, undefined behavior and Valgrind complained about it. --- neo/idlib/Str.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neo/idlib/Str.h b/neo/idlib/Str.h index 3ac1cd62..70e6c9dd 100644 --- a/neo/idlib/Str.h +++ b/neo/idlib/Str.h @@ -519,6 +519,10 @@ ID_INLINE char &idStr::operator[]( int index ) { #pragma GCC diagnostic pop ID_INLINE void idStr::operator=( const idStr &text ) { + if (&text == this) { + return; + } + int l; l = text.Length();