diff --git a/src/coreclr/inc/sbuffer.inl b/src/coreclr/inc/sbuffer.inl index 7ef7795631c82..53449a18e0988 100644 --- a/src/coreclr/inc/sbuffer.inl +++ b/src/coreclr/inc/sbuffer.inl @@ -258,7 +258,8 @@ inline void SBuffer::Set(const BYTE *buffer, COUNT_T size) // From the code for Resize, this is clearly impossible. PREFIX_ASSUME( (this->m_buffer != NULL) || (size == 0) ); - MoveMemory(m_buffer, buffer, size); + if (size != 0) + MoveMemory(m_buffer, buffer, size); RETURN; } diff --git a/src/coreclr/vm/baseassemblyspec.inl b/src/coreclr/vm/baseassemblyspec.inl index 1d79bf50a7ffe..125e31a592a9e 100644 --- a/src/coreclr/vm/baseassemblyspec.inl +++ b/src/coreclr/vm/baseassemblyspec.inl @@ -243,10 +243,11 @@ inline BOOL BaseAssemblySpec::CompareEx(BaseAssemblySpec *pSpec, DWORD dwCompare || strcmp(m_pAssemblyName, pSpec->m_pAssemblyName))) return FALSE; - if (m_cbPublicKeyOrToken != pSpec->m_cbPublicKeyOrToken - || memcmp(m_pbPublicKeyOrToken, pSpec->m_pbPublicKeyOrToken, m_cbPublicKeyOrToken)) + if (m_cbPublicKeyOrToken != pSpec->m_cbPublicKeyOrToken) return FALSE; + if (m_cbPublicKeyOrToken != 0 && memcmp(m_pbPublicKeyOrToken, pSpec->m_pbPublicKeyOrToken, m_cbPublicKeyOrToken) != 0) + return FALSE; if (m_dwFlags != pSpec->m_dwFlags) return FALSE;