Skip to content

Commit

Permalink
[mono] Prevent direct MonoClass field access
Browse files Browse the repository at this point in the history
Fixes mono/mono#15544

### After adding configure flag
<img width="874" alt="Screen Shot 2020-01-30 at 10 54 25 AM" src="https://user-images.githubusercontent.com/16830051/73466184-81f4c180-434f-11ea-87f0-0863c32b1251.png">

### After using m_class accessors
<img width="865" alt="Screen Shot 2020-01-30 at 10 55 04 AM" src="https://user-images.githubusercontent.com/16830051/73466229-93d66480-434f-11ea-8914-cef5571a0528.png">

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
  • Loading branch information
mdh1418 committed Jan 30, 2020
1 parent a85d902 commit 1e69986
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/mono/mono/mini/mini-wasm-debugger.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,11 @@ static gboolean describe_value(MonoType * type, gpointer addr)
} else {
GString *class_name;
class_name = g_string_new ("");
if (*(obj->vtable->klass->name_space)) {
g_string_append (class_name, obj->vtable->klass->name_space);
if (*(m_class_get_name_space (obj->vtable->klass))) {
g_string_append (class_name, m_class_get_name_space (obj->vtable->klass));
g_string_append_c (class_name, '.');
}
g_string_append (class_name, obj->vtable->klass->name);
g_string_append (class_name, m_class_get_name (obj->vtable->klass));
if (m_class_get_byval_arg (obj->vtable->klass)->type == MONO_TYPE_SZARRAY || m_class_get_byval_arg (obj->vtable->klass)->type == MONO_TYPE_ARRAY)
mono_wasm_add_array_var (class_name->str, get_object_id(obj));
else
Expand Down Expand Up @@ -821,11 +821,11 @@ describe_this (MonoStackFrameInfo *info, MonoContext *ctx, gpointer ud)
mono_wasm_add_properties_var("this");
GString *class_name;
class_name = g_string_new ("");
if (*(obj->vtable->klass->name_space)) {
g_string_append (class_name, obj->vtable->klass->name_space);
if (*(m_class_get_name_space (obj->vtable->klass))) {
g_string_append (class_name, m_class_get_name_space (obj->vtable->klass));
g_string_append_c (class_name, '.');
}
g_string_append (class_name, obj->vtable->klass->name);
g_string_append (class_name, m_class_get_name (obj->vtable->klass));
mono_wasm_add_obj_var (class_name->str, get_object_id(obj));
g_string_free(class_name, FALSE);
}
Expand Down

0 comments on commit 1e69986

Please sign in to comment.