From 01929519b67c45def0abde8e37192a0fd09d9d05 Mon Sep 17 00:00:00 2001 From: "DELL_THAYS\\thays" Date: Thu, 28 Jul 2022 12:07:31 -0300 Subject: [PATCH] Fix assert when passing an invalid array to runtime. --- src/mono/mono/component/debugger-agent.c | 3 +++ src/mono/wasm/debugger/DebuggerTestSuite/ArrayTests.cs | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/component/debugger-agent.c b/src/mono/mono/component/debugger-agent.c index b08aa1949c6330..bc05ac29606746 100644 --- a/src/mono/mono/component/debugger-agent.c +++ b/src/mono/mono/component/debugger-agent.c @@ -9466,6 +9466,9 @@ array_commands (int command, guint8 *p, guint8 *end, Buffer *buf) if (err != ERR_NONE) return err; + if (m_class_get_rank (arr->obj.vtable->klass) == 0) + return ERR_INVALID_OBJECT; + switch (command) { case CMD_ARRAY_REF_GET_TYPE: { buffer_add_byte(buf, m_class_get_byval_arg (m_class_get_element_class (arr->obj.vtable->klass))->type); diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/ArrayTests.cs b/src/mono/wasm/debugger/DebuggerTestSuite/ArrayTests.cs index 6c1c96cc18173c..5bd0665174dc28 100644 --- a/src/mono/wasm/debugger/DebuggerTestSuite/ArrayTests.cs +++ b/src/mono/wasm/debugger/DebuggerTestSuite/ArrayTests.cs @@ -564,8 +564,6 @@ await CompareObjectPropertiesFor(frame_locals, "this", } [ConditionalFact(nameof(RunningOnChrome))] - [Trait("Category", "windows-failing")] // https://github.com/dotnet/runtime/issues/65742 - [Trait("Category", "linux-failing")] // https://github.com/dotnet/runtime/issues/65742 public async Task InvalidArrayId() => await CheckInspectLocalsAtBreakpointSite( "DebuggerTests.Container", "PlaceholderMethod", 1, "DebuggerTests.Container.PlaceholderMethod", "window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.ArrayTestsClass:ObjectArrayMembers'); }, 1);",