static HandleData *
gc_handles_for_type (GCHandleType type)
{
- g_assert (type < HANDLE_TYPE_MAX);
- return &gc_handles [type];
+ return type < HANDLE_TYPE_MAX ? &gc_handles [type] : NULL;
}
/* This assumes that the world is stopped. */
guint index = MONO_GC_HANDLE_SLOT (gchandle);
guint type = MONO_GC_HANDLE_TYPE (gchandle);
HandleData *handles = gc_handles_for_type (type);
+ /* Invalid handles are possible; accessing one should produce NULL. (#34276) */
+ if (!handles)
+ return NULL;
guint bucket, offset;
g_assert (index < handles->capacity);
bucketize (index, &bucket, &offset);
guint index = MONO_GC_HANDLE_SLOT (gchandle);
guint type = MONO_GC_HANDLE_TYPE (gchandle);
HandleData *handles = gc_handles_for_type (type);
+ if (!handles)
+ return;
guint bucket, offset;
gpointer slot;
guint index = MONO_GC_HANDLE_SLOT (gchandle);
guint type = MONO_GC_HANDLE_TYPE (gchandle);
HandleData *handles = gc_handles_for_type (type);
+ if (!handles)
+ return NULL;
guint bucket, offset;
if (index >= handles->capacity)
return NULL;
guint index = MONO_GC_HANDLE_SLOT (gchandle);
guint type = MONO_GC_HANDLE_TYPE (gchandle);
HandleData *handles = gc_handles_for_type (type);
+ if (!handles)
+ return;
guint bucket, offset;
gpointer slot;
bucketize (index, &bucket, &offset);