Hello everyone, I have a function to decrypt a string using cryptopp 563. It is quite old code that has been working for ages on linux and windows. But recently I ran the unit test for the first time on solaris 10. It core dumped. The stack trace is shown below. CountWords has reg.m_ptr as null even though the size is non-null. Is this an internal error? Perhaps it should return zero if the reg.m_ptr is zero. Not sure. Anyhow, the stack trace shows that the Integer object is returned from RSAFunction::PreimageBound, which returns the private data member m_n. This is created using the default ctor. The comment in integer.h says this ctor creates the zero integer. Looking at the code of the ctor it seems ok so it seems to me that m_n must have been re-assigned to an Integer with m_ptr as null.
=>[1] CryptoPP::CountWords(X = (nil), N = 81U), line 11 in "words.h" [2] CryptoPP::Integer::WordCount(this = 0x1085f7a68), line 3106 in "integer.cpp" [3] CryptoPP::Integer::Integer(this = 0xffffffff7fffd328, t = CLASS), line 2828 in "integer.cpp" [4] CryptoPP::RSAFunction::PreimageBound(this = 0x1085f7a50), line 42 in "rsa.h" [5] CryptoPP::NameValuePairs::GetValue<CryptoPP::InvertibleRSAFunction>(this = 0xffffffff7fffd328, name = 0x1085f7a50 "ThisObject:CryptoPP::InvertibleRSAFunction", value = CLASS), line 321 in "cryptlib.h" [6] CryptoPP::NameValuePairs::GetThisObject<CryptoPP::InvertibleRSAFunction>(this = 0xffffffff7fffd328, object = CLASS), line 299 in "cryptlib.h" [7] CryptoPP::AssignFromHelperClass<CryptoPP::InvertibleRSAFunction,CryptoPP::RSAFunction>::AssignFromHelperClass(this = 0xffffffff7fffc888, pObject = 0xffffffff7fffcf98, source = CLASS), line 260 in "algparam.h" [8] CryptoPP::AssignFromHelper<CryptoPP::RSAFunction,CryptoPP::InvertibleRSAFunction>(pObject = 0xffffffff7fffcf98, source = CLASS, dummy = (nil)), line 306 in "algparam.h" [9] CryptoPP::InvertibleRSAFunction::AssignFrom(this = 0xffffffff7fffcf98, source = CLASS), line 289 in "rsa.cpp" [10] CryptoPP::PK_FinalTemplate<CryptoPP::TF_DecryptorImpl<CryptoPP::TF_CryptoSchemeOptions<CryptoPP::TF_ES<CryptoPP::OAEP<CryptoPP::SHA1,CryptoPP::P1363_MGF1>,CryptoPP::RSA,int>,CryptoPP::RSA,CryptoPP::OAEP<CryptoPP::SHA1,CryptoPP::P1363_MGF1> > > >::PK_FinalTemplate(this = 0xffffffff7fffcf80, key = CLASS), line 1776 in "pubkey.h" [11] decryptString(0xffffffff7fffd908, 0xffffffff7fffda58, 0xffffffff7fffda38, 0xffffffff4afb0010, 0xffffffff7fffd9c0, 0x0), at 0x104c6a4a4 [12] StringServicesTest::testDecryptString(0x108717ab0, 0x1, 0x1, 0x100, 0x10859dc00, 0x1085a40e0), at 0x101b1b0b8 There seems to be a logic error somewhere such that an invalid Integer object is created. When I hack CountWords to return zero if the array pointer is null I get a core dump in CopyWords where it tries to copy from a null array (using memcpy). If I put in another hack to make CopyWords a no-op when given a null input array then this avoids the crash but the decryption produces an empty string. I am using the oracle compiler sunCC version 12.4. It also core dumps on solaris 11. -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
