Skip to content

Commit

Permalink
Ensure a null PublicKey is supported on assembly refs (#108928)
Browse files Browse the repository at this point in the history
Co-authored-by: Steve Harter <[email protected]>
  • Loading branch information
github-actions[bot] and steveharter authored Oct 18, 2024
1 parent b678c8a commit a9d9707
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/coreclr/md/compiler/importhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3174,6 +3174,8 @@ ImportHelper::CreateAssemblyRefFromAssembly(
mdAssemblyRef tkAssemRef;
HRESULT hr = S_OK;
StrongNameToken token;
const void *pbToken = NULL;
ULONG cbToken = 0;
ULONG i;

// Set output to Nil.
Expand All @@ -3193,6 +3195,9 @@ ImportHelper::CreateAssemblyRefFromAssembly(
IfFailGo(StrongNameTokenFromPublicKey((BYTE*)pbPublicKey,
cbPublicKey,
&token));

pbToken = &token;
cbToken = StrongNameToken::SIZEOF_TOKEN;
}
else
_ASSERTE(!IsAfPublicKey(dwFlags));
Expand All @@ -3209,8 +3214,8 @@ ImportHelper::CreateAssemblyRefFromAssembly(
continue;

// See if the AssemblyRef already exists in the emit scope.
hr = FindAssemblyRef(pMiniMdEmit, szName, szLocale, &token,
StrongNameToken::SIZEOF_TOKEN, usMajorVersion, usMinorVersion,
hr = FindAssemblyRef(pMiniMdEmit, szName, szLocale, pbToken,
cbToken, usMajorVersion, usMinorVersion,
usBuildNumber, usRevisionNumber, dwFlags,
&tkAssemRef);
if (hr == CLDB_E_RECORD_NOTFOUND)
Expand Down

0 comments on commit a9d9707

Please sign in to comment.