Fwd: New Defects reported by Coverity Scan for Cryptopp

5 views
Skip to first unread message

Jeffrey Walton

unread,
Aug 18, 2017, 6:01:20 AM8/18/17
to Crypto++ Users List
FYI...

---------- Forwarded message ----------
From: <scan-...@coverity.com>
Date: Fri, Aug 18, 2017 at 4:39 AM
Subject: New Defects reported by Coverity Scan for Cryptopp
To: webm...@cryptopp.com

Hi,

Please find the latest report on new defect(s) introduced to Cryptopp
found with Coverity Scan.

4 new defect(s) introduced to Cryptopp found with Coverity Scan.
20 defect(s), reported by Coverity Scan earlier, were marked fixed in
the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 4 of 4 defect(s)


** CID 182771: Uninitialized members (UNINIT_CTOR)
/aria.h: 54 in CryptoPP::ARIA::Base::Base()()


________________________________________________________________________________________________________
*** CID 182771: Uninitialized members (UNINIT_CTOR)
/aria.h: 54 in CryptoPP::ARIA::Base::Base()()
48 void ProcessAndXorBlock(const byte *inBlock, const
byte *xorBlock, byte *outBlock) const;
49
50 private:
51 // Reference implementation allocates a table of 17 round keys.
52 FixedSizeAlignedSecBlock<byte, 16*17> m_rk; // round keys
53 FixedSizeAlignedSecBlock<word32, 4*7> m_w; // w0,
w1, w2, w3, t and u
>>> CID 182771: Uninitialized members (UNINIT_CTOR)
>>> The compiler-generated constructor for this class does not initialize "m_rounds".
54 unsigned int m_rounds;
55 };
56
57 public:
58 typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
59 typedef BlockCipherFinal<DECRYPTION, Base> Decryption;

** CID 182770: (CONSTANT_EXPRESSION_RESULT)
/secblock.h: 106 in CryptoPP::AllocatorBase<char>::CheckSize(unsigned long)()
/secblock.h: 106 in CryptoPP::AllocatorBase<unsigned
char>::CheckSize(unsigned long)()


________________________________________________________________________________________________________
*** CID 182770: (CONSTANT_EXPRESSION_RESULT)
/secblock.h: 106 in CryptoPP::AllocatorBase<char>::CheckSize(unsigned long)()
100 //! optimize it well under all circumstances.
Compilers like GCC, ICC and MSVC appear
101 //! to optimize it well in either form.
102 //! \note size is the count of elements, and not the
number of bytes
103 static void CheckSize(size_t size)
104 {
105 // C++ throws std::bad_alloc (C++03) or
std::bad_array_new_length (C++11) here.
>>> CID 182770: (CONSTANT_EXPRESSION_RESULT)
>>> "size > 18446744073709551615UL /* CryptoPP::AllocatorBase<char>::ELEMS_MAX */" is always false regardless of the values of its operands. This occurs as the logical operand of "if".
106 if (size > ELEMS_MAX)
107 throw InvalidArgument("AllocatorBase:
requested size would cause integer overflow");
108 }
109 };
110
111 #define CRYPTOPP_INHERIT_ALLOCATOR_TYPES \
/secblock.h: 106 in CryptoPP::AllocatorBase<unsigned
char>::CheckSize(unsigned long)()
100 //! optimize it well under all circumstances.
Compilers like GCC, ICC and MSVC appear
101 //! to optimize it well in either form.
102 //! \note size is the count of elements, and not the
number of bytes
103 static void CheckSize(size_t size)
104 {
105 // C++ throws std::bad_alloc (C++03) or
std::bad_array_new_length (C++11) here.
>>> CID 182770: (CONSTANT_EXPRESSION_RESULT)
>>> "size > 18446744073709551615UL /* CryptoPP::AllocatorBase<unsigned char>::ELEMS_MAX */" is always false regardless of the values of its operands. This occurs as the logical operand of "if".
106 if (size > ELEMS_MAX)
107 throw InvalidArgument("AllocatorBase:
requested size would cause integer overflow");
108 }
109 };
110
111 #define CRYPTOPP_INHERIT_ALLOCATOR_TYPES \

** CID 182769: (CHECKED_RETURN)
/validat1.cpp: 2256 in CryptoPP::Test::ValidateRC2()()
/validat1.cpp: 2257 in CryptoPP::Test::ValidateRC2()()


________________________________________________________________________________________________________
*** CID 182769: (CHECKED_RETURN)
/validat1.cpp: 2256 in CryptoPP::Test::ValidateRC2()()
2250 bool pass=true, fail;
2251
2252 while (valdata.MaxRetrievable())
2253 {
2254 byte keyLen, effectiveLen;
2255
>>> CID 182769: (CHECKED_RETURN)
>>> Calling "Get" without checking return value (as is done elsewhere 17 out of 20 times).
2256 valdata.Get(keyLen);
2257 valdata.Get(effectiveLen);
2258 valdata.Get(key, keyLen);
2259 valdata.Get(plain, RC2Encryption::BLOCKSIZE);
2260 valdata.Get(cipher, RC2Encryption::BLOCKSIZE);
2261
/validat1.cpp: 2257 in CryptoPP::Test::ValidateRC2()()
2251
2252 while (valdata.MaxRetrievable())
2253 {
2254 byte keyLen, effectiveLen;
2255
2256 valdata.Get(keyLen);
>>> CID 182769: (CHECKED_RETURN)
>>> Calling "Get" without checking return value (as is done elsewhere 17 out of 20 times).
2257 valdata.Get(effectiveLen);
2258 valdata.Get(key, keyLen);
2259 valdata.Get(plain, RC2Encryption::BLOCKSIZE);
2260 valdata.Get(cipher, RC2Encryption::BLOCKSIZE);
2261
2262 member_ptr<BlockTransformation> transE(new
RC2Encryption(key, keyLen, effectiveLen));

** CID 182768: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
/regtest1.cpp: 60 in RegisterFactories(CryptoPP::Test::TestClass)()


________________________________________________________________________________________________________
*** CID 182768: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
/regtest1.cpp: 60 in RegisterFactories(CryptoPP::Test::TestClass)()
54 return;
55
56 if ((suites & Test::Unkeyed) == Test::Unkeyed)
57 RegisterFactories1();
58
59 if ((suites & Test::SharedKeyMAC) == Test::SharedKeyMAC ||
>>> CID 182768: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
>>> "(suites & CryptoPP::Test::SharedKeyMAC) == CryptoPP::Test::SharedKeyStream" is always false regardless of the values of its operands. This occurs as the logical second operand of "||".
60 (suites & Test::SharedKeyMAC) == Test::SharedKeyStream ||
61 (suites & Test::SharedKeyMAC) == Test::SharedKeyBlock)
62 RegisterFactories2();
63
64 if ((suites & Test::PublicKey) == Test::PublicKey)
65 RegisterFactories3();
Reply all
Reply to author
Forward
0 new messages