Skip to content

Commit

Permalink
Merge pull request #2069 from Unity-Technologies/bugfix/oob-coverage-…
Browse files Browse the repository at this point in the history
…info-write

Fix memory overwrite when performing nested inlines with code coverag…
  • Loading branch information
UnityAlex authored Oct 7, 2024
2 parents 6a9c5a3 + f7a9760 commit 274abac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mono/mini/method-to-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -4602,6 +4602,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
MonoMethod *prev_current_method;
MonoGenericContext *prev_generic_context;
gboolean ret_var_set, prev_ret_var_set, prev_disable_inline, virtual_ = FALSE;
MonoProfilerCoverageInfo *prev_coverage_info;

g_assert (cfg->exception_type == MONO_EXCEPTION_NONE);

Expand Down Expand Up @@ -4675,6 +4676,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
prev_current_method = cfg->current_method;
prev_generic_context = cfg->generic_context;
prev_disable_inline = cfg->disable_inline;
prev_coverage_info = cfg->coverage_info;

cfg->ret_var_set = FALSE;
cfg->inline_depth ++;
Expand All @@ -4699,6 +4701,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
cfg->generic_context = prev_generic_context;
cfg->ret_var_set = prev_ret_var_set;
cfg->disable_inline = prev_disable_inline;
cfg->coverage_info = prev_coverage_info;
cfg->inline_depth --;

if ((costs >= 0 && costs < 60) || inline_always || (costs >= 0 && (cmethod->iflags & METHOD_IMPL_ATTRIBUTE_AGGRESSIVE_INLINING))) {
Expand Down

0 comments on commit 274abac

Please sign in to comment.