Uploaded image for project: 'Commons Crypto'
  1. Commons Crypto
  2. CRYPTO-141

Errors in native code can leave Java wrappers in bad state

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.1.0
    • Native
    • None

    Description

      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():

        if (result == 0 && context != NULL) {
          if (CONTEXT(ctx) != NULL) {
            dlsym_EVP_CIPHER_CTX_cleanup(context);
          } else {
            dlsym_EVP_CIPHER_CTX_free(context);
          }
        }
      

      The address known to the Java side will now be invalid, and if any native method is now called the JVM will crash.

      Attachments

        Activity

          People

            vanzin Marcelo Masiero Vanzin
            vanzin Marcelo Masiero Vanzin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: