--- a/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c Thu Jul 28 06:02:40 2016 -0700
+++ b/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c Thu Jul 28 09:53:08 2016 -0700
@@ -278,6 +278,12 @@
hb_buffer_set_direction(buffer, direction);
chars = (*env)->GetCharArrayElements(env, text, NULL);
+ if ((*env)->ExceptionCheck(env)) {
+ hb_buffer_destroy(buffer);
+ hb_font_destroy(hbfont);
+ free((void*)jdkFontInfo);
+ return JNI_FALSE;
+ }
len = (*env)->GetArrayLength(env, text);
hb_buffer_add_utf16(buffer, chars, len, offset, limit-offset);
@@ -309,6 +315,7 @@
hb_font_destroy(hbfont);
free((void*)jdkFontInfo);
if (features != NULL) free(features);
+ (*env)->ReleaseCharArrayElements(env, text, chars, JNI_ABORT);
return JNI_TRUE;
}