From 46f52550a23b5dffe651775f90b703999806292a Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Fri, 7 Aug 2015 15:43:07 +0200 Subject: [PATCH] Fixed self-overwriteing during assignment of secureFixedHash --- libdevcore/FixedHash.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index e0125b005..973bc174e 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -238,7 +238,14 @@ public: explicit SecureFixedHash(bytes const* _d, ConstructFromPointerType _t): FixedHash(_d, _t) {} ~SecureFixedHash() { ref().cleanse(); } - SecureFixedHash& operator=(SecureFixedHash const& _c) { ref().cleanse(); FixedHash::operator=(static_cast const&>(_c)); return *this; } + SecureFixedHash& operator=(SecureFixedHash const& _c) + { + if (&_c == this) + return *this; + ref().cleanse(); + FixedHash::operator=(static_cast const&>(_c)); + return *this; + } using FixedHash::size;