Skip to content

Commit 4870075

Browse files
committed
Add support to process null strings in attributes
- Checking for sentinel value in string ID creating a null string instance.
1 parent 38faac2 commit 4870075

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/CLR/Core/TypeSystem.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7183,7 +7183,16 @@ HRESULT CLR_RT_AttributeParser::ReadString(CLR_RT_HeapBlock *&value)
71837183

71847184
NANOCLR_READ_UNALIGNED_UINT16(tk, m_blob);
71857185

7186-
NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_String::CreateInstance(*value, CLR_TkFromType(TBL_Strings, tk), m_assm));
7186+
// check for invalid string ID: "null" string
7187+
if (tk == 0xFFFF)
7188+
{
7189+
// create a null string
7190+
NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_String::CreateInstance(*value, nullptr, m_assm));
7191+
}
7192+
else
7193+
{
7194+
NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_String::CreateInstance(*value, CLR_TkFromType(TBL_Strings, tk), m_assm));
7195+
}
71877196

71887197
// need to box this
71897198
value->PerformBoxing(desc.m_handlerCls);

0 commit comments

Comments
 (0)