Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono][aot] Fix infinite recursion in the AOT dwarf emitter. #79310

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/mono/mono/mini/dwarfwriter.c
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,11 @@ emit_class_dwarf_info (MonoDwarfWriter *w, MonoClass *klass, gboolean vtype)
if (die)
return die;

if (m_class_is_ginst (klass) && !vtype) {
/* This could lead to recursion */
return NULL;
}

if (!((m_class_get_byval_arg (klass)->type == MONO_TYPE_CLASS) || (m_class_get_byval_arg (klass)->type == MONO_TYPE_OBJECT) || m_class_get_byval_arg (klass)->type == MONO_TYPE_GENERICINST || m_class_is_enumtype (klass) || (m_class_get_byval_arg (klass)->type == MONO_TYPE_VALUETYPE && vtype) ||
(m_class_get_byval_arg (klass)->type >= MONO_TYPE_BOOLEAN && m_class_get_byval_arg (klass)->type <= MONO_TYPE_R8 && !vtype)))
return NULL;
Expand Down Expand Up @@ -1174,6 +1179,8 @@ get_type_die (MonoDwarfWriter *w, MonoType *t)
case MONO_TYPE_GENERICINST:
if (!MONO_TYPE_ISSTRUCT (t)) {
tdie = (const char *)g_hash_table_lookup (w->class_to_reference_die, klass);
if (!tdie)
tdie = ".LDIE_OBJECT";
} else {
tdie = ".LDIE_I4";
}
Expand Down