Hi Uri,

Thanks.OS version and clang version is project binding right now. But
certainly, will check.

Do you see any obvious problem in the code snippet I have added in the
above post?

Regards,
Sunandan

On Sun, Apr 18, 2021 at 5:45 PM Uri Blumenthal <mouse...@gmail.com> wrote:

> Considering that the current stable version of Clang is 11, would or not
> make sense to upgrade your compiler?
>
> Not to mention that your OS probably does not get any security patches now
> - so, perhaps, moving from 18.04LTS to 20.04 LTS would be a good idea?
>
> I regularly build with Clang and GCC, no crashes.
>
> On Apr 18, 2021, at 08:02, Sunandan Nandi <sunandan.na...@gmail.com>
> wrote:
>
> Hi,
>
> I am experiencing Segfault inside CryptoPP::StreamTransformationFilter.
>
> *Overview:*
> I have downloaded and built CryptoPP as an external CMake module.
> *Problem:*
> This segfault is happening only in Linux(Ubuntu 18.04.05LTS) *Release
> build*.
> 64-bit,compiler clang 6.0
>
> *GDB BT*
> Thread 9 "***" received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7fffdb7fe700 (LWP 5835)]
> 0x0000000000000000 in ?? ()
> (gdb) bt
> #0  0x0000000000000000 in ?? ()
> #1  *0x0000000000b7559d in
> CryptoPP::StreamTransformationFilter::StreamTransformationFilter
> (this=0x7fffdb7fd1c0, c=..., attachment=<optimized out>,*
>     *padding=<optimized out>) at filters.cpp:593*
> #2  0x00000000004ff4fd in
> ***::AESEncryptDecryptUtility::decrypt(std::__cxx11::basic_string<char,
> std::char_traits<char>, std::allocator<char> > const&) ()
>
> *Trials to resolve this issue:*
> If I build my target where I am using CryptoPP( static lib) with *optimization
> level O1 or less, then no segfault observed. But this issue is with
> optimization level O2 or more.*
>
> *Code snippet:*
> std::string AESEncryptDecryptUtility::decrypt(const std::string&
> encrypted_text) { std::string decrypted_text; CryptoPP::AES::Decryption
> aesDecryption(key_.data(), KEY_LENGTH);
> CryptoPP::CBC_Mode_ExternalCipher::Decryption cbcDecryption(aesDecryption,
> iv_.data()); CryptoPP::*StreamTransformationFilter 
> *stfDecryptor(cbcDecryption,
> new CryptoPP::StringSink(decrypted_text));
> stfDecryptor.Put(reinterpret_cast<const unsigned
> char*>(encrypted_text.c_str()), encrypted_text.size());
> stfDecryptor.MessageEnd(); return decrypted_text;
>
> Inside *StreamTransformationFilter() *where it's crashing, the line
> highlighted in Red is pointing in GDB as the last point before the
> crash(segfault)
>
> StreamTransformationFilter::StreamTransformationFilter(StreamTransformation
> &c, BufferedTransformation *attachment, BlockPaddingScheme padding)
>
> : FilterWithBufferedInput(attachment), m_cipher(c), m_padding(DEFAULT_PADDING)
> {
>     CRYPTOPP_ASSERT(c.MinLastBlockSize() == 0 || c.MinLastBlockSize()
> > c.MandatoryBlockSize());
>
>     const bool authenticatedFilter
> = dynamic_cast<AuthenticatedSymmetricCipher *>(&c) != NULLPTR;
>     if (authenticatedFilter)
>         throw InvalidArgument("StreamTransformationFilter: please use
> AuthenticatedEncryptionFilter and AuthenticatedDecryptionFilter for
> AuthenticatedSymmetricCipher");
>
>     // InitializeDerivedAndReturnNewSizes may override some of these
>     m_mandatoryBlockSize = m_cipher.MandatoryBlockSize();
>
> Please let me know if any other information needed.
>
> Regards,
> Sunandan
>
>
>
> --
> 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 cryptopp-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/cryptopp-users/e6c860f6-1e74-4372-b4de-691e0692747bn%40googlegroups.com
> <https://groups.google.com/d/msgid/cryptopp-users/e6c860f6-1e74-4372-b4de-691e0692747bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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 cryptopp-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/cryptopp-users/17A2AD5B-284E-406B-8C8E-EAB3F80F85B5%40gmail.com
> <https://groups.google.com/d/msgid/cryptopp-users/17A2AD5B-284E-406B-8C8E-EAB3F80F85B5%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAKPYA22Gv%3Dr_HNg3j3Dom_E4yRcv6eH6sDX%2B2qbRrkT9vT4W1A%40mail.gmail.com.

Reply via email to