tags:

views:

40

answers:

1

When using the Botan::SecureVector in the following unit test:

void UnitTest()
{
    std::vector<byte> vbData;
    vbData.push_back(0x04);
    vbData.push_back(0x04);
    vbData.push_back(0x04);

    Botan::SecureVector<Botan::byte> svData(&vbData[0], vbData.size());
    CPPUNIT_ASSERT(vbData == std::vector<byte>(svData.begin(), svData.end()));
}

a segmentation fault occurs when trying to allocate the SecureVector as it tries to deallocate a buffer during its construction.

+3  A: 

Add line:

LibraryInitializer botanInit;

to function.

This seemed to me to be odd behavior, so I figured I should post it.

sheepsimulator