8278753: Runtime crashes with access violation during JNI_CreateJavaVM call

Reviewed-by: dholmes, stuefe
This commit is contained in:
Yumin Qi 2022-02-03 18:02:40 +00:00
parent 86c24b319e
commit cda9c3011b
6 changed files with 35 additions and 31 deletions

View file

@ -99,7 +99,8 @@ static FindEntry_t FindEntry = NULL;
static ReadEntry_t ReadEntry = NULL;
static GetNextEntry_t GetNextEntry = NULL;
static Crc32_t Crc32 = NULL;
int ClassLoader::_libzip_loaded = 0;
int ClassLoader::_libzip_loaded = 0;
void* ClassLoader::_zip_handle = NULL;
// Entry points for jimage.dll for loading jimage file entries
@ -942,20 +943,19 @@ void ClassLoader::load_zip_library() {
assert(ZipOpen == NULL, "should not load zip library twice");
char path[JVM_MAXPATHLEN];
char ebuf[1024];
void* handle = NULL;
if (os::dll_locate_lib(path, sizeof(path), Arguments::get_dll_dir(), "zip")) {
handle = os::dll_load(path, ebuf, sizeof ebuf);
_zip_handle = os::dll_load(path, ebuf, sizeof ebuf);
}
if (handle == NULL) {
if (_zip_handle == NULL) {
vm_exit_during_initialization("Unable to load zip library", path);
}
ZipOpen = CAST_TO_FN_PTR(ZipOpen_t, dll_lookup(handle, "ZIP_Open", path));
ZipClose = CAST_TO_FN_PTR(ZipClose_t, dll_lookup(handle, "ZIP_Close", path));
FindEntry = CAST_TO_FN_PTR(FindEntry_t, dll_lookup(handle, "ZIP_FindEntry", path));
ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, dll_lookup(handle, "ZIP_ReadEntry", path));
GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, dll_lookup(handle, "ZIP_GetNextEntry", path));
Crc32 = CAST_TO_FN_PTR(Crc32_t, dll_lookup(handle, "ZIP_CRC32", path));
ZipOpen = CAST_TO_FN_PTR(ZipOpen_t, dll_lookup(_zip_handle, "ZIP_Open", path));
ZipClose = CAST_TO_FN_PTR(ZipClose_t, dll_lookup(_zip_handle, "ZIP_Close", path));
FindEntry = CAST_TO_FN_PTR(FindEntry_t, dll_lookup(_zip_handle, "ZIP_FindEntry", path));
ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, dll_lookup(_zip_handle, "ZIP_ReadEntry", path));
GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, dll_lookup(_zip_handle, "ZIP_GetNextEntry", path));
Crc32 = CAST_TO_FN_PTR(Crc32_t, dll_lookup(_zip_handle, "ZIP_CRC32", path));
}
void ClassLoader::load_jimage_library() {