Skip to content

AccessViolation Exception BlockCipher when deleting any Symmetric Algorithm/Mode on Windows #8

Description

@LightBender

Stack Trace for EAX:

TitaniumNET.dll!std::default_deleteBotan::BlockCipher::operator()(Botan::BlockCipher * _Ptr) Line 1200 + 0x2e bytes C++
TitaniumNET.dll!std::unique_ptrBotan::BlockCipher,std::default_delete<Botan::BlockCipher >::~unique_ptrBotan::BlockCipher,std::default_delete<Botan::BlockCipher >() Line 1449 C++
TitaniumNET.dll!Botan::EAX_Mode::~EAX_Mode() + 0x73 bytes C++
TitaniumNET.dll!Botan::EAX_Decryption::~EAX_Decryption() + 0x28 bytes C++
TitaniumNET.dll!Botan::EAX_Decryption::`scalar deleting destructor'() + 0x2c bytes C++
TitaniumNET.dll!std::default_deleteBotan::EAX_Decryption::operator()(Botan::EAX_Decryption * _Ptr) Line 1200 + 0x31 bytes C++
TitaniumNET.dll!std::unique_ptrBotan::EAX_Decryption,std::default_delete<Botan::EAX_Decryption >::~unique_ptrBotan::EAX_Decryption,std::default_delete<Botan::EAX_Decryption >() Line 1449 C++

Stack Trace for GCM:

TitaniumNET.dll!std::default_deleteBotan::BlockCipher::operator()(Botan::BlockCipher * _Ptr) Line 1200 + 0x2e bytes C++
TitaniumNET.dll!std::unique_ptrBotan::BlockCipher,std::default_delete<Botan::BlockCipher >::~unique_ptrBotan::BlockCipher,std::default_delete<Botan::BlockCipher >() Line 1449 C++
TitaniumNET.dll!Botan::CTR_BE::~CTR_BE() + 0x51 bytes C++
TitaniumNET.dll!Botan::CTR_BE::scalar deleting destructor'() + 0x2c bytes C++ TitaniumNET.dll!std::default_delete<Botan::StreamCipher>::operator()(Botan::StreamCipher * _Ptr) Line 1200 + 0x30 bytes C++ TitaniumNET.dll!std::unique_ptr<Botan::StreamCipher,std::default_delete<Botan::StreamCipher> >::~unique_ptr<Botan::StreamCipher,std::default_delete<Botan::StreamCipher> >() Line 1449 C++ TitaniumNET.dll!Botan::GCM_Mode::~GCM_Mode() + 0x40 bytes C++ TitaniumNET.dll!Botan::GCM_Decryption::~GCM_Decryption() + 0x28 bytes C++ TitaniumNET.dll!Botan::GCM_Decryption::scalar deleting destructor'() + 0x2c bytes C++
TitaniumNET.dll!std::default_deleteBotan::GCM_Decryption::operator()(Botan::GCM_Decryption * _Ptr) Line 1200 + 0x31 bytes C++
TitaniumNET.dll!std::unique_ptrBotan::GCM_Decryption,std::default_delete<Botan::GCM_Decryption >::~unique_ptrBotan::GCM_Decryption,std::default_delete<Botan::GCM_Decryption >() Line 1449 C++

I don't have this problem with Hashes so it's probably not the .NET Interop code since those layers are functionally identical.

Activity

  1. randombit commented on Jan 26, 2014

    @randombit
    Owner

    Can you provide a (portable) example which demonstrates this issue? I'm not aware of any reason this kind of crash should happen and without a way to replicate it it is difficult to diagnose.

  2. LightBender commented on Jan 26, 2014

    @LightBender
    Author

    I'll see what I can do, but the first thing I want to find out is if I'm even using it correctly. In my constructor I have the following:
    AES128 = unique_ptrBotan::AES_128(new Botan::AES_128());
    GCME = unique_ptrBotan::GCM_Encryption(new Botan::GCM_Encryption(AES128.get(), AuthSize));
    GCMD = unique_ptrBotan::GCM_Decryption(new Botan::GCM_Decryption(AES128.get(), AuthSize));

    Does that look like a valid usage? I am still getting used the API so I might be doing it wrong.

  3. randombit commented on Jan 26, 2014

    @randombit
    Owner

    It looks like you are passing the same unique_ptr to both GCM constructors. Each takes ownership, which would cause a double-delete. You need to pass unique instances to each object.

  4. LightBender commented on Jan 26, 2014

    @LightBender
    Author

    That would do it. I didn't know that they take ownership. I'll close this.

  5. LightBender commented on Jan 26, 2014

    @LightBender
    Author

    I got it all sorted out. Thanks for pointing me in the right direction!

  6. added a commit that references this issue on Dec 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions