Search code examples
c#.netclrstringbuilderreference-source

What does ----s mean in the context of StringBuilder.ToString()?


The Reference Source page for stringbuilder.cs has this comment in the ToString method:

if (chunk.m_ChunkLength > 0)
{
    // Copy these into local variables so that they 
    // are stable even in the presence of ----s (hackers might do this)
    char[] sourceArray = chunk.m_ChunkChars;
    int chunkOffset = chunk.m_ChunkOffset;
    int chunkLength = chunk.m_ChunkLength;

What does this mean? Is ----s something a malicious user might insert into a string to be formatted?


Solution

  • In the CoreCLR repository you have a fuller quote:

    Copy these into local variables so that they are stable even in the presence of race conditions

    Github

    Basically: it's a threading consideration.