Skip to content

Commit

Permalink
[mono][interp] Return null for localloc with len 0 (#73174)
Browse files Browse the repository at this point in the history
so that accessing the result address throws exception.

Fixes #54359
  • Loading branch information
BrzVlad committed Aug 9, 2022
1 parent e117479 commit e4dd880
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
11 changes: 8 additions & 3 deletions src/mono/mono/mini/interp/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7127,10 +7127,15 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK;

MINT_IN_CASE(MINT_LOCALLOC) {
int len = LOCAL_VAR (ip [2], gint32);
gpointer mem = frame_data_allocator_alloc (&context->data_stack, frame, ALIGN_TO (len, MINT_VT_ALIGNMENT));
gpointer mem;
if (len > 0) {
mem = frame_data_allocator_alloc (&context->data_stack, frame, ALIGN_TO (len, MINT_VT_ALIGNMENT));

if (frame->imethod->init_locals)
memset (mem, 0, len);
if (frame->imethod->init_locals)
memset (mem, 0, len);
} else {
mem = NULL;
}
LOCAL_VAR (ip [1], gpointer) = mem;
ip += 3;
MINT_IN_BREAK;
Expand Down
15 changes: 0 additions & 15 deletions src/tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2504,9 +2504,6 @@
<ExcludeList Include = "$(XunitTestBinBase)/JIT/Regression/JitBlue/DevDiv_544983/DevDiv_544983/**">
<Issue>https://github.com/dotnet/runtime/issues/54393</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/JIT/CodeGenBringUpTests/Localloc_do/**">
<Issue>https://github.com/dotnet/runtime/issues/54359</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/JIT/Directed/Misc/function_pointer/MutualThdRecur-fptr/**">
<Issue>needs triage</Issue>
</ExcludeList>
Expand Down Expand Up @@ -2624,9 +2621,6 @@
<ExcludeList Include = "$(XunitTestBinBase)/JIT/Methodical/eh/interactions/strswitchfinal_d/**">
<Issue>needs triage</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/JIT/CodeGenBringUpTests/Localloc_do/**">
<Issue>https://github.com/dotnet/runtime/issues/54359</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/JIT/Directed/Misc/function_pointer/MutualThdRecur-fptr/**">
<Issue>needs triage</Issue>
</ExcludeList>
Expand All @@ -2642,15 +2636,6 @@
<ExcludeList Include = "$(XunitTestBinBase)/Loader/classloader/DefaultInterfaceMethods/diamondshape/diamondshape_r/**">
<Issue>https://github.com/dotnet/runtime/issues/54399</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/JIT/CodeGenBringUpTests/Localloc_r/**">
<Issue>https://github.com/dotnet/runtime/issues/54359</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/JIT/CodeGenBringUpTests/Localloc_ro/**">
<Issue>https://github.com/dotnet/runtime/issues/54359</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/JIT/CodeGenBringUpTests/Localloc_d/**">
<Issue>https://github.com/dotnet/runtime/issues/54359</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/JIT/Regression/CLR-x86-JIT/V1-M09.5-PDC/b25459/b25459/**">
<Issue>https://github.com/dotnet/runtime/issues/54393</Issue>
</ExcludeList>
Expand Down

0 comments on commit e4dd880

Please sign in to comment.