[Delta] QCA unhandled exception at termination in windows
Justin Karneges
justin-psi2 at affinix.com
Mon Mar 3 22:47:06 PST 2008
On Monday 03 March 2008 9:38 pm, Acenes wrote:
> > This should not happen.
> > Can you share the source code to QCATest.exe ?
> > -Justin
>
> The source code is completely in the tar archive of qca-2.0.0:
>
> examples/md5crypt/md5crypt.cpp
Okay, I've figured it out. md5crypt.cpp is wrong. So much for setting a good
example to follow. :)
Actually, this is a really obscure aspect of QCA to know about. This code:
QCA::Initializer init;
QCA::SecureArray password, salt;
QCoreApplication app ( argc, argv );
should be written like this instead:
QCA::Initializer init;
QCoreApplication app ( argc, argv );
QCA::SecureArray password, salt;
QCA uses qAddPostRoutine() to deinitialize QCA. This means that when
QCoreApplication destructs, QCA is deinitialized (QCA::Initializer object
destruction then becomes a no-op). As you can see, the way md5crypt.cpp is
written, those SecureArray will be deleted *after* QCA deinitializes. Best
fix is to do nothing between Initializer and QCoreApplication construction.
Sorry about that!
-Justin
More information about the Delta
mailing list