aco: guard small_vector move/copy operator against self assignment

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33043>
This commit is contained in:
Georg Lehmann
2025-01-15 17:44:50 +01:00
committed by Marge Bot
parent 3c7c059cee
commit 15cba08db0
+4
View File
@@ -1080,6 +1080,8 @@ public:
constexpr small_vec& operator=(const small_vec& other)
{
if (&other == this)
return *this;
clear();
reserve(other.capacity);
length = other.length;
@@ -1089,6 +1091,8 @@ public:
constexpr small_vec& operator=(small_vec&& other) noexcept
{
if (&other == this)
return *this;
clear();
void* ptr = this;
memcpy(ptr, &other, sizeof(*this));