Skip to content

Commit

Permalink
Merge pull request #1278 from Unity-Technologies/unity-master-blindfi…
Browse files Browse the repository at this point in the history
…x-1232819

Attempting to guard against MONO_HANDLE_IS_NULL performing a null der…
  • Loading branch information
UnityAlex authored Apr 2, 2020
2 parents 271cbf2 + bdb62c2 commit aaa11d8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mono/metadata/handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ void mono_handle_verify (MonoRawHandle handle);

#define MONO_HANDLE_CAST(TYPE, VALUE) (TYPED_HANDLE_NAME(TYPE))( VALUE )

#define MONO_HANDLE_IS_NULL(HANDLE) (MONO_HANDLE_SUPPRESS (MONO_HANDLE_RAW(HANDLE) == NULL))
#define MONO_HANDLE_IS_NULL(HANDLE) (mono_handle_is_null (HANDLE))


/*
Expand Down Expand Up @@ -491,6 +491,13 @@ Init values to it.
*/
extern const MonoObjectHandle mono_null_value_handle;

static inline gboolean
mono_handle_is_null (MonoRawHandle handle)
{
// Double NULL check is required for this to work with NULL_HANDLE.
return !(handle && MONO_HANDLE_SUPPRESS (MONO_HANDLE_RAW((MonoObjectHandle)handle)));
}

static inline void
mono_handle_assign (MonoObjectHandleOut dest, MonoObjectHandle src)
{
Expand Down

0 comments on commit aaa11d8

Please sign in to comment.