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/15 10:53:26 UTC
[jira] Closed: (HARMONY-4163) [drlvm][jvmti]
GetLocalVariableTable() crashes due to misprint in
Method::get_local_var_entry()
[ 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.