Skip to content

Commit e21bdfe

Browse files
Fix use of uninitialized bool value (#100560)
Fixes #100559
1 parent b040ed6 commit e21bdfe

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/coreclr/vm/methodtablebuilder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2783,7 +2783,7 @@ MethodTableBuilder::EnumerateClassMethods()
27832783
}
27842784
}
27852785

2786-
bool hasGenericMethodArgsComputed;
2786+
bool hasGenericMethodArgsComputed = false;
27872787
bool hasGenericMethodArgs = this->GetModule()->m_pMethodIsGenericMap->IsGeneric(tok, &hasGenericMethodArgsComputed);
27882788
if (!hasGenericMethodArgsComputed)
27892789
{

src/coreclr/vm/readytoruninfo.cpp

+9-12
Original file line numberDiff line numberDiff line change
@@ -1929,20 +1929,17 @@ bool ReadyToRun_TypeGenericInfoMap::HasConstraints(mdTypeDef input, bool *foundR
19291929

19301930
bool ReadyToRun_MethodIsGenericMap::IsGeneric(mdMethodDef input, bool *foundResult) const
19311931
{
1932-
#ifdef DACCESS_COMPILE
1933-
*foundResult = false;
1934-
return false;
1935-
#else
1932+
#ifndef DACCESS_COMPILE
19361933
uint32_t rid = RidFromToken(input);
1937-
if ((rid > MethodCount) || (rid == 0))
1934+
if ((rid <= MethodCount) && (rid != 0))
19381935
{
1939-
*foundResult = false;
1940-
return false;
1936+
uint8_t chunk = ((uint8_t*)&MethodCount)[((rid - 1) / 8) + sizeof(uint32_t)];
1937+
chunk >>= 7 - ((rid - 1) % 8);
1938+
*foundResult = true;
1939+
return !!(chunk & 1);
19411940
}
1942-
1943-
uint8_t chunk = ((uint8_t*)&MethodCount)[((rid - 1) / 8) + sizeof(uint32_t)];
1944-
chunk >>= 7 - ((rid - 1) % 8);
1945-
return !!(chunk & 1);
1946-
#endif
1941+
#endif // !DACCESS_COMPILE
1942+
*foundResult = false;
1943+
return false;
19471944
}
19481945

0 commit comments

Comments
 (0)