Skip to content
Prev Previous commit
Next Next commit
added guard in mono_install_marshal_callbacks
  • Loading branch information
Nathan Ricci committed May 25, 2022
commit 95ef2395496be8a3f98d2ebec4708766fd19504c
10 changes: 6 additions & 4 deletions src/mono/mono/metadata/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -6180,10 +6180,12 @@ mono_install_marshal_callbacks (MonoMarshalLightweightCallbacks *cb)
mono_wasm_print_stack_trace ();
#endif

g_assert (!lightweight_cb_inited);
g_assert (cb->version == MONO_MARSHAL_CALLBACKS_VERSION);
memcpy (&marshal_lightweight_cb, cb, sizeof (MonoMarshalLightweightCallbacks));
lightweight_cb_inited = TRUE;
if(!lightweight_cb_inited) {
g_assert (!lightweight_cb_inited);
g_assert (cb->version == MONO_MARSHAL_CALLBACKS_VERSION);
memcpy (&marshal_lightweight_cb, cb, sizeof (MonoMarshalLightweightCallbacks));
lightweight_cb_inited = TRUE;
}
}

gboolean
Expand Down