Skip to content

Commit c99d384

Browse files
authored
properly enumerate uninstrumented bounds (#119965)
* properly enumerate uninstrumented bounds * use alignup to account for multi-byte reads
1 parent 12ca85b commit c99d384

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/coreclr/vm/debuginfostore.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,12 +1406,23 @@ void CompressDebugInfo::EnumMemoryRegions(CLRDataEnumMemoryFlags flags, PTR_BYTE
14061406
_ASSERTE(flagByte == 0);
14071407
}
14081408

1409-
NibbleReader r(pDebugInfo, 12 /* maximum size of compressed 2 UINT32s */);
1409+
NibbleReader r(pDebugInfo, 24 /* maximum size of compressed 4 UINT32s */);
14101410

14111411
ULONG cbBounds = r.ReadEncodedU32();
1412+
ULONG cbUninstrumentedBounds = 0;
1413+
if (cbBounds == DebugInfoBoundsHasInstrumentedBounds)
1414+
{
1415+
// This means we have instrumented bounds.
1416+
cbBounds = r.ReadEncodedU32();
1417+
cbUninstrumentedBounds = r.ReadEncodedU32();
1418+
}
14121419
ULONG cbVars = r.ReadEncodedU32();
14131420

1414-
pDebugInfo += r.GetNextByteIndex() + cbBounds + cbVars;
1421+
pDebugInfo += r.GetNextByteIndex() + cbBounds + cbUninstrumentedBounds + cbVars;
1422+
1423+
// NibbleReader reads in units of sizeof(NibbleChunkType)
1424+
// So we need to account for any partial chunk at the end.
1425+
pDebugInfo = AlignUp(dac_cast<TADDR>(pDebugInfo), sizeof(NibbleReader::NibbleChunkType));
14151426

14161427
DacEnumMemoryRegion(dac_cast<TADDR>(pStart), pDebugInfo - pStart);
14171428
}

0 commit comments

Comments
 (0)