Skip to content

Commit 35a39e9

Browse files
authored
Fix a read-out-of-local error in the MD library. (#83906)
Fixes #73718. Based on #73736
1 parent e07a513 commit 35a39e9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/coreclr/md/runtime/metamodel.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -717,13 +717,17 @@ CMiniMdBase::InitColsForTable(
717717
// should we write the data into the structure
718718
{
719719
const CMiniTableDef *pTemplate; // Template table definition.
720-
CMiniColDef pCols[9]; // The col defs to init.
720+
// Mark the array of columns as not allocated (not ALLOCATED_MEMORY_MARKER) for SetNewColumnDefinition
721+
const uint8_t MAX_COL_COUNT = 9;
722+
BYTE colData[1 + sizeof(CMiniColDef) * MAX_COL_COUNT];
723+
colData[0] = 0;
724+
CMiniColDef* pCols = BYTEARRAY_TO_COLDES(colData);
721725
BYTE iOffset; // Running size of a record.
722726
BYTE iSize; // Size of a field.
723727
HRESULT hr = S_OK;
724728

725729
_ASSERTE((bExtra == 0) || (bExtra == 1));
726-
_ASSERTE(ARRAY_SIZE(pCols) >= pTable->m_cCols);
730+
_ASSERTE(MAX_COL_COUNT >= pTable->m_cCols);
727731

728732
bExtra = 0;//<TODO>@FUTURE: save in schema header. until then use 0.</TODO>
729733

0 commit comments

Comments
 (0)