Skip to content

Commit

Permalink
[mono][interp] Return null for localloc with len 0
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 4, 2022
1 parent 4f835ae commit 9b7d58f
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 @@ -2510,9 +2510,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 @@ -2630,9 +2627,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 @@ -2648,15 +2642,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 9b7d58f

Please sign in to comment.