提交 a7aa8c5c 编写于 作者: K ksrini

7166955: (pack200) JNI_GetCreatedJavaVMs needs additional checking

Reviewed-by: alanb, dholmes, ksrini
Contributed-by: youdwei@linux.vnet.ibm.com
上级 80712e21
/*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -82,7 +82,11 @@ static unpacker* get_unpacker(JNIEnv *env, jobject pObj, bool noCreate=false) {
static unpacker* get_unpacker() {
//fprintf(stderr, "get_unpacker()\n");
JavaVM* vm = null;
JNI_GetCreatedJavaVMs(&vm, 1, null);
jsize nVM = 0;
jint retval = JNI_GetCreatedJavaVMs(&vm, 1, &nVM);
// other VM implements may differ, thus for correctness, we need these checks
if (retval != JNI_OK || nVM != 1)
return null;
void* envRaw = null;
vm->GetEnv(&envRaw, JNI_VERSION_1_1);
JNIEnv* env = (JNIEnv*) envRaw;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册