sxs: avoid uninitialised len_name length

The redirect_data->clrdata_len is unset in /dlls/ntdll/actctx.c#L4411-4412 when using registration-free COM in C# NET code.

Program.cs

//...


Guid guid = Guid.Parse("COM clsid");
Type type = Type.GetTypeFromCLSID(guid, true);
var instance = Activator.CreateInstance(type));
//...

App.manifest

<assembly>
  <file name="ExampleCOM.dll">
    <comClass description="ExampleCOM" progid="ExampleCOM" clsid="{COM clsid}" threadingModel="Free"/>
  </file>
</assembly>

The above C# code gets this error on its second line.

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

This is because len_name is uninitialized when calling memcpy(ret_strings, ptr_name, len_name); in SxsLookupClrGuid, which is fixed in this MR.

Edited by Hans Chen

Merge request reports

Loading