diff --git a/src/coreclr/vm/debuginfostore.cpp b/src/coreclr/vm/debuginfostore.cpp index 9852d79e8324f2..2687329aea9862 100644 --- a/src/coreclr/vm/debuginfostore.cpp +++ b/src/coreclr/vm/debuginfostore.cpp @@ -1406,12 +1406,23 @@ void CompressDebugInfo::EnumMemoryRegions(CLRDataEnumMemoryFlags flags, PTR_BYTE _ASSERTE(flagByte == 0); } - NibbleReader r(pDebugInfo, 12 /* maximum size of compressed 2 UINT32s */); + NibbleReader r(pDebugInfo, 24 /* maximum size of compressed 4 UINT32s */); ULONG cbBounds = r.ReadEncodedU32(); + ULONG cbUninstrumentedBounds = 0; + if (cbBounds == DebugInfoBoundsHasInstrumentedBounds) + { + // This means we have instrumented bounds. + cbBounds = r.ReadEncodedU32(); + cbUninstrumentedBounds = r.ReadEncodedU32(); + } ULONG cbVars = r.ReadEncodedU32(); - pDebugInfo += r.GetNextByteIndex() + cbBounds + cbVars; + pDebugInfo += r.GetNextByteIndex() + cbBounds + cbUninstrumentedBounds + cbVars; + + // NibbleReader reads in units of sizeof(NibbleChunkType) + // So we need to account for any partial chunk at the end. + pDebugInfo = AlignUp(dac_cast(pDebugInfo), sizeof(NibbleReader::NibbleChunkType)); DacEnumMemoryRegion(dac_cast(pStart), pDebugInfo - pStart); }