From 15cba08db04f927b69adacbc04d23102b8b25ca5 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Wed, 15 Jan 2025 17:44:50 +0100 Subject: [PATCH] aco: guard small_vector move/copy operator against self assignment Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_util.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/amd/compiler/aco_util.h b/src/amd/compiler/aco_util.h index 607b10e31cb..a945a1ffaea 100644 --- a/src/amd/compiler/aco_util.h +++ b/src/amd/compiler/aco_util.h @@ -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));