You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Ivan Popov (JIRA)" <ji...@apache.org> on 2007/06/14 15:06:27 UTC
[jira] Created: (HARMONY-4163) [drlvm][jvmti]
GetLocalVariableTable() crashes due to misprint in
Method::get_local_var_entry()
[drlvm][jvmti] GetLocalVariableTable() crashes due to misprint in Method::get_local_var_entry()
-----------------------------------------------------------------------------------------------
Key: HARMONY-4163
URL: https://issues.apache.org/jira/browse/HARMONY-4163
Project: Harmony
Issue Type: Bug
Components: DRLVM
Environment: Windows/x86, harmony-jdk-r547139
Reporter: Ivan Popov
Some failures of EUT tests (org.eclipse.jdt.core.tests.eval.DebugEvaluationTests) described in HARMONY-3282 are because of DRLVM crashes in JVMTI function GetLocalVariableTable(). Quick investigation revealed that the problem is in misprint in implementation of the function Method::get_local_var_entry() (file vmcore\src\class_support\Class_File_Loader.cpp line 1240):
bool Method::get_local_var_entry(unsigned index, jlong* pc,
jint* length, jint* slot, String** name,
String** type, String** generic_type) {
if (_line_number_table && index < _local_vars_table->length) {
^^^^^^^^^^^^^^^^^^^^^^^^^^
*pc = _local_vars_table->table[index].start_pc;
*length = _local_vars_table->table[index].length;
*slot = _local_vars_table->table[index].index;
*name = _local_vars_table->table[index].name;
*type = _local_vars_table->table[index].type;
*generic_type = _local_vars_table->table[index].generic_type;
return true;
} else {
return false;
}
}
In the first line this function incorrectly uses '_line_number_table' instead of '_local_vars_table'.
In this particular case '_line_number_table' is NULL and function does not set any data and returns false. However, calling function jvmtiGetLocalVariableTable() does not check returned result and uses uninitialized data (file jvmti_method.cpp, line 436):
jvmtiError JNICALL
jvmtiGetLocalVariableTable(jvmtiEnv* env,
jmethodID method,
jint* entry_count_ptr,
jvmtiLocalVariableEntry** table_ptr)
{
...
for( index = 0; index < count; index++)
{
String *name, *type, *generic_type;
jvmtiLocalVariableEntry* entry = *table_ptr + index;
method_ptr->get_local_var_entry(index,
&(entry->start_location),
&(entry->length),
&(entry->slot),
&name, &type, &generic_type); // <--- does not check for false result
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// allocate memory for name
len = get_utf8_length_of_8bit( (const uint8*)name->bytes, name->len);
result = _allocate( len + 1, (unsigned char**)&pointer );
if( result != JVMTI_ERROR_NONE ) {
return result;
}
...
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (HARMONY-4163) [drlvm][jvmti]
GetLocalVariableTable() crashes due to misprint in
Method::get_local_var_entry()
Posted by "Ivan Popov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-4163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ivan Popov updated HARMONY-4163:
--------------------------------
Attachment: drlvm_jvmti.patch
Attached patch 'drlvm_jvmti.patch' fixes mistype in Method::get_local_var_entry(). With this patch failed EUT tests pass.
It might make sense also to improve implementation of GetLocalVariableTable() to check result returned by get_local_var_entry() and don't use uninitialized data.
> [drlvm][jvmti] GetLocalVariableTable() crashes due to misprint in Method::get_local_var_entry()
> -----------------------------------------------------------------------------------------------
>
> Key: HARMONY-4163
> URL: https://issues.apache.org/jira/browse/HARMONY-4163
> Project: Harmony
> Issue Type: Bug
> Components: DRLVM
> Environment: Windows/x86, harmony-jdk-r547139
> Reporter: Ivan Popov
> Attachments: drlvm_jvmti.patch
>
>
> Some failures of EUT tests (org.eclipse.jdt.core.tests.eval.DebugEvaluationTests) described in HARMONY-3282 are because of DRLVM crashes in JVMTI function GetLocalVariableTable(). Quick investigation revealed that the problem is in misprint in implementation of the function Method::get_local_var_entry() (file vmcore\src\class_support\Class_File_Loader.cpp line 1240):
> bool Method::get_local_var_entry(unsigned index, jlong* pc,
> jint* length, jint* slot, String** name,
> String** type, String** generic_type) {
> if (_line_number_table && index < _local_vars_table->length) {
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> *pc = _local_vars_table->table[index].start_pc;
> *length = _local_vars_table->table[index].length;
> *slot = _local_vars_table->table[index].index;
> *name = _local_vars_table->table[index].name;
> *type = _local_vars_table->table[index].type;
> *generic_type = _local_vars_table->table[index].generic_type;
> return true;
> } else {
> return false;
> }
> }
> In the first line this function incorrectly uses '_line_number_table' instead of '_local_vars_table'.
> In this particular case '_line_number_table' is NULL and function does not set any data and returns false. However, calling function jvmtiGetLocalVariableTable() does not check returned result and uses uninitialized data (file jvmti_method.cpp, line 436):
> jvmtiError JNICALL
> jvmtiGetLocalVariableTable(jvmtiEnv* env,
> jmethodID method,
> jint* entry_count_ptr,
> jvmtiLocalVariableEntry** table_ptr)
> {
> ...
> for( index = 0; index < count; index++)
> {
> String *name, *type, *generic_type;
> jvmtiLocalVariableEntry* entry = *table_ptr + index;
> method_ptr->get_local_var_entry(index,
> &(entry->start_location),
> &(entry->length),
> &(entry->slot),
> &name, &type, &generic_type); // <--- does not check for false result
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> // allocate memory for name
> len = get_utf8_length_of_8bit( (const uint8*)name->bytes, name->len);
> result = _allocate( len + 1, (unsigned char**)&pointer );
> if( result != JVMTI_ERROR_NONE ) {
> return result;
> }
> ...
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (HARMONY-4163) [drlvm][jvmti]
GetLocalVariableTable() crashes due to misprint in
Method::get_local_var_entry()
Posted by "Gregory Shimansky (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-4163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gregory Shimansky resolved HARMONY-4163.
----------------------------------------
Resolution: Fixed
Assignee: Gregory Shimansky
You are right, this is a mistake in class file loader, it was also found in code review here: https://issues.apache.org/jira/browse/HARMONY-3741#action_12498557
I've committed your patch at 547248. Please check that the bug is fixed for you.
> [drlvm][jvmti] GetLocalVariableTable() crashes due to misprint in Method::get_local_var_entry()
> -----------------------------------------------------------------------------------------------
>
> Key: HARMONY-4163
> URL: https://issues.apache.org/jira/browse/HARMONY-4163
> Project: Harmony
> Issue Type: Bug
> Components: DRLVM
> Environment: Windows/x86, harmony-jdk-r547139
> Reporter: Ivan Popov
> Assignee: Gregory Shimansky
> Attachments: drlvm_jvmti.patch
>
>
> Some failures of EUT tests (org.eclipse.jdt.core.tests.eval.DebugEvaluationTests) described in HARMONY-3282 are because of DRLVM crashes in JVMTI function GetLocalVariableTable(). Quick investigation revealed that the problem is in misprint in implementation of the function Method::get_local_var_entry() (file vmcore\src\class_support\Class_File_Loader.cpp line 1240):
> bool Method::get_local_var_entry(unsigned index, jlong* pc,
> jint* length, jint* slot, String** name,
> String** type, String** generic_type) {
> if (_line_number_table && index < _local_vars_table->length) {
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> *pc = _local_vars_table->table[index].start_pc;
> *length = _local_vars_table->table[index].length;
> *slot = _local_vars_table->table[index].index;
> *name = _local_vars_table->table[index].name;
> *type = _local_vars_table->table[index].type;
> *generic_type = _local_vars_table->table[index].generic_type;
> return true;
> } else {
> return false;
> }
> }
> In the first line this function incorrectly uses '_line_number_table' instead of '_local_vars_table'.
> In this particular case '_line_number_table' is NULL and function does not set any data and returns false. However, calling function jvmtiGetLocalVariableTable() does not check returned result and uses uninitialized data (file jvmti_method.cpp, line 436):
> jvmtiError JNICALL
> jvmtiGetLocalVariableTable(jvmtiEnv* env,
> jmethodID method,
> jint* entry_count_ptr,
> jvmtiLocalVariableEntry** table_ptr)
> {
> ...
> for( index = 0; index < count; index++)
> {
> String *name, *type, *generic_type;
> jvmtiLocalVariableEntry* entry = *table_ptr + index;
> method_ptr->get_local_var_entry(index,
> &(entry->start_location),
> &(entry->length),
> &(entry->slot),
> &name, &type, &generic_type); // <--- does not check for false result
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> // allocate memory for name
> len = get_utf8_length_of_8bit( (const uint8*)name->bytes, name->len);
> result = _allocate( len + 1, (unsigned char**)&pointer );
> if( result != JVMTI_ERROR_NONE ) {
> return result;
> }
> ...
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (HARMONY-4163) [drlvm][jvmti]
GetLocalVariableTable() crashes due to misprint in
Method::get_local_var_entry()
Posted by "Ivan Popov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-4163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ivan Popov closed HARMONY-4163.
-------------------------------
Thanks, Gregory. Verified in harmony-jdk-r547543. Closing this issue.
> [drlvm][jvmti] GetLocalVariableTable() crashes due to misprint in Method::get_local_var_entry()
> -----------------------------------------------------------------------------------------------
>
> Key: HARMONY-4163
> URL: https://issues.apache.org/jira/browse/HARMONY-4163
> Project: Harmony
> Issue Type: Bug
> Components: DRLVM
> Environment: Windows/x86, harmony-jdk-r547139
> Reporter: Ivan Popov
> Assignee: Gregory Shimansky
> Attachments: drlvm_jvmti.patch
>
>
> Some failures of EUT tests (org.eclipse.jdt.core.tests.eval.DebugEvaluationTests) described in HARMONY-3282 are because of DRLVM crashes in JVMTI function GetLocalVariableTable(). Quick investigation revealed that the problem is in misprint in implementation of the function Method::get_local_var_entry() (file vmcore\src\class_support\Class_File_Loader.cpp line 1240):
> bool Method::get_local_var_entry(unsigned index, jlong* pc,
> jint* length, jint* slot, String** name,
> String** type, String** generic_type) {
> if (_line_number_table && index < _local_vars_table->length) {
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> *pc = _local_vars_table->table[index].start_pc;
> *length = _local_vars_table->table[index].length;
> *slot = _local_vars_table->table[index].index;
> *name = _local_vars_table->table[index].name;
> *type = _local_vars_table->table[index].type;
> *generic_type = _local_vars_table->table[index].generic_type;
> return true;
> } else {
> return false;
> }
> }
> In the first line this function incorrectly uses '_line_number_table' instead of '_local_vars_table'.
> In this particular case '_line_number_table' is NULL and function does not set any data and returns false. However, calling function jvmtiGetLocalVariableTable() does not check returned result and uses uninitialized data (file jvmti_method.cpp, line 436):
> jvmtiError JNICALL
> jvmtiGetLocalVariableTable(jvmtiEnv* env,
> jmethodID method,
> jint* entry_count_ptr,
> jvmtiLocalVariableEntry** table_ptr)
> {
> ...
> for( index = 0; index < count; index++)
> {
> String *name, *type, *generic_type;
> jvmtiLocalVariableEntry* entry = *table_ptr + index;
> method_ptr->get_local_var_entry(index,
> &(entry->start_location),
> &(entry->length),
> &(entry->slot),
> &name, &type, &generic_type); // <--- does not check for false result
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> // allocate memory for name
> len = get_utf8_length_of_8bit( (const uint8*)name->bytes, name->len);
> result = _allocate( len + 1, (unsigned char**)&pointer );
> if( result != JVMTI_ERROR_NONE ) {
> return result;
> }
> ...
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.