Skip to content

Commit 6307b9b

Browse files
author
Brian Raderman
committed
Remove assert when retrieving value of string with invalid chars
Fix for Unity case 1052246. Debugger was asserting when trying to retrieve the value of a string that has invalid characters. The assert will crash the Unity player/editor. Changing to detect error, free the string if necessary, and return an error code to the client.
1 parent 5ec8270 commit 6307b9b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mono/mini/debugger-agent.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11456,7 +11456,13 @@ string_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
1145611456
} else {
1145711457
MonoError error;
1145811458
s = mono_string_to_utf8_checked (str, &error);
11459-
mono_error_assert_ok (&error);
11459+
if (!mono_error_ok (&error)) {
11460+
if (s)
11461+
g_free (s);
11462+
11463+
return ERR_INVALID_ARGUMENT;
11464+
}
11465+
1146011466
buffer_add_string (buf, s);
1146111467
g_free (s);
1146211468
}

0 commit comments

Comments
 (0)