The method createLockObject will return NULL if any exception is thrown, but 
there is no NULL verification in p11_general.c after the following line is 
invoked
notifyListLock = createLockObject(env);

There may be a pending exception when invoking prefetchFields(env, thisClass);

So adding exception check to return immediately and do not call any further JNI 
functions when there is exception pending.

-------------

Commit messages:
 - 8366807: JNI exception pending in 
Java_sun_security_pkcs11_wrapper_PKCS11_initializeLibrary of p11_general.c:106
 - 8366807: JNI exception pending in 
Java_sun_security_pkcs11_wrapper_PKCS11_initializeLibrary of p11_general.c:106

Changes: https://git.openjdk.org/jdk/pull/28799/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28799&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8366807
  Stats: 7 lines in 1 file changed: 6 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/28799.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28799/head:pull/28799

PR: https://git.openjdk.org/jdk/pull/28799

Reply via email to