Skip to content

Commit d4601d3

Browse files
authored
Make ComponentActivator.[LoadAssemblyAnd]GetFunctionPointer set initialize out pointer to 0 (dotnet#107426)
1 parent 1f6a0d4 commit d4601d3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ public static unsafe int LoadAssemblyAndGetFunctionPointer(IntPtr assemblyPathNa
6767
IntPtr reserved,
6868
IntPtr functionHandle)
6969
{
70+
if (functionHandle != IntPtr.Zero)
71+
*(IntPtr*)functionHandle = 0;
72+
7073
if (!IsSupported)
7174
return HostFeatureDisabled;
7275

@@ -229,6 +232,9 @@ public static unsafe int GetFunctionPointer(IntPtr typeNameNative,
229232
IntPtr reserved,
230233
IntPtr functionHandle)
231234
{
235+
if (functionHandle != IntPtr.Zero)
236+
*(IntPtr*)functionHandle = 0;
237+
232238
if (!IsSupported)
233239
{
234240
#if CORECLR

0 commit comments

Comments
 (0)