[
https://issues.apache.org/jira/browse/CRYPTO-141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Marcelo Vanzin resolved CRYPTO-141.
-----------------------------------
Resolution: Fixed
Assignee: Marcelo Vanzin
Fix Version/s: 1.1.0
> 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
> Assignee: Marcelo Vanzin
> Priority: Major
> Fix For: 1.1.0
>
>
> 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)