summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--algparam.cpp1
-rw-r--r--ec2n.cpp8
-rw-r--r--gf2n.cpp1
-rw-r--r--queue.cpp10
-rw-r--r--secblock.h1
5 files changed, 13 insertions, 8 deletions
diff --git a/algparam.cpp b/algparam.cpp
index 42962ffa..9976fb28 100644
--- a/algparam.cpp
+++ b/algparam.cpp
@@ -61,6 +61,7 @@ AlgorithmParameters::AlgorithmParameters(const AlgorithmParameters &x)
AlgorithmParameters & AlgorithmParameters::operator=(const AlgorithmParameters &x)
{
+ // Should this be guarded for operations on itself??? This class befuddles me at times...
m_next.reset(const_cast<AlgorithmParameters &>(x).m_next.release());
return *this;
}
diff --git a/ec2n.cpp b/ec2n.cpp
index f54cb087..01c7e3fc 100644
--- a/ec2n.cpp
+++ b/ec2n.cpp
@@ -237,9 +237,11 @@ const EC2N::Point& EC2N::Double(const Point &P) const
/*
EcPrecomputation<EC2N>& EcPrecomputation<EC2N>::operator=(const EcPrecomputation<EC2N> &rhs)
{
- m_ec = rhs.m_ec;
- m_ep = rhs.m_ep;
- m_ep.m_group = m_ec.get();
+ if (this != &rhs)
+ {
+ DL_GroupPrecomputation::operator=(rhs);
+ m_ec = rhs.m_ec;
+ }
return *this;
}
diff --git a/gf2n.cpp b/gf2n.cpp
index 7ff02f33..004eb780 100644
--- a/gf2n.cpp
+++ b/gf2n.cpp
@@ -211,6 +211,7 @@ unsigned int PolynomialMod2::Parity() const
PolynomialMod2& PolynomialMod2::operator=(const PolynomialMod2& t)
{
+ // Assign guards for self-assignment
reg.Assign(t.reg);
return *this;
}
diff --git a/queue.cpp b/queue.cpp
index 3beb731c..4a319cb5 100644
--- a/queue.cpp
+++ b/queue.cpp
@@ -428,17 +428,17 @@ byte * ByteQueue::CreatePutSpace(size_t &size)
ByteQueue & ByteQueue::operator=(const ByteQueue &rhs)
{
- if (this == &rhs) return *this;
-
- Destroy();
- CopyFrom(rhs);
+ if (this != &rhs)
+ {
+ Destroy();
+ CopyFrom(rhs);
+ }
return *this;
}
bool ByteQueue::operator==(const ByteQueue &rhs) const
{
const lword currentSize = CurrentSize();
-
if (currentSize != rhs.CurrentSize())
return false;
diff --git a/secblock.h b/secblock.h
index 39d0c913..907bca87 100644
--- a/secblock.h
+++ b/secblock.h
@@ -331,6 +331,7 @@ public:
SecBlock<T, A>& operator=(const SecBlock<T, A> &t)
{
+ // Assign guards for self-assignment
Assign(t);
return *this;
}