MikePopoloski/StringFormatter

wrong calculation of size creates random undetectable crashes!

Aristos opened this issue · 0 comments

In the function of CheckCapacity , if the (currentCount + count) is for example 200, and the buffer.Length=32, then the total buffer will be 64, not enough to keep the 200 size !

        void CheckCapacity (int count) {
            if (currentCount + count > buffer.Length)
                Array.Resize(ref buffer, buffer.Length * 2);
        }