diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2007-08-13 23:55:05 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2007-08-13 23:55:05 +0000 |
commit | d1fbb8a047100fb8e424f69b2e7e4eb6ac289c53 (patch) | |
tree | cc49f245e3cb95a6458b5a8ea55fc608166e214f | |
parent | 31f8aa2671a0fce7255114fd03dab238dbcce12f (diff) | |
download | cryptopp-d1fbb8a047100fb8e424f69b2e7e4eb6ac289c53.tar.gz |
fix valgrind issues reported by Chris Morgan
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@387 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r-- | filters.cpp | 3 | ||||
-rw-r--r-- | words.h | 3 | ||||
-rw-r--r-- | zdeflate.cpp | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/filters.cpp b/filters.cpp index 47a91a3..9f4308b 100644 --- a/filters.cpp +++ b/filters.cpp @@ -509,7 +509,8 @@ size_t RandomNumberSink::Put2(const byte *begin, size_t length, int messageEnd, size_t ArraySink::Put2(const byte *begin, size_t length, int messageEnd, bool blocking) { - memcpy(m_buf+m_total, begin, STDMIN(length, SaturatingSubtract(m_size, m_total))); + if (m_buf+m_total != begin) + memcpy(m_buf+m_total, begin, STDMIN(length, SaturatingSubtract(m_size, m_total))); m_total += length; return 0; } @@ -20,7 +20,8 @@ inline void SetWords(word *r, word a, size_t n) inline void CopyWords(word *r, const word *a, size_t n) { - memcpy(r, a, n*WORD_SIZE); + if (r != a) + memcpy(r, a, n*WORD_SIZE); } inline void XorWords(word *r, const word *a, const word *b, size_t n) diff --git a/zdeflate.cpp b/zdeflate.cpp index 426e438..ae5e1a7 100644 --- a/zdeflate.cpp +++ b/zdeflate.cpp @@ -221,6 +221,7 @@ Deflator::Deflator(BufferedTransformation *attachment, int deflateLevel, int log Deflator::Deflator(const NameValuePairs ¶meters, BufferedTransformation *attachment) : LowFirstBitWriter(attachment) + , m_deflateLevel(-1) { InitializeStaticEncoders(); IsolatedInitialize(parameters); |