Marcelo Vanzin created CRYPTO-141:
-------------------------------------
Summary: Errors in native code can leave Java wrappers in bad state
Key: CRYPTO-141
URL: https://issues.apache.org/jira/browse/CRYPTO-141
Project: Commons Crypto
Issue Type: Bug
Components: Native
Reporter: Marcelo Vanzin
Currently, the Java side keeps a reference to the address of the EVP context,
and checks that it's not 0 before performing any operations.
But if an error happens in native code, for example here in init():
{code}
if (result == 0 && context != NULL) {
if (CONTEXT(ctx) != NULL) {
dlsym_EVP_CIPHER_CTX_cleanup(context);
} else {
dlsym_EVP_CIPHER_CTX_free(context);
}
}
{code}
The address known to the Java side will now be invalid, and if any native
method is now called the JVM will crash.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)