From 2942a9be3c9505199880daac7c4e101a245d3de2 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Tue, 4 Sep 2018 23:09:33 +0200 Subject: [PATCH] Constructor should copy only the desired chars If startIndex is not zero and length not value.length the last line in the constructor would throw an exception. --- source/System/Text/StringBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/System/Text/StringBuilder.cs b/source/System/Text/StringBuilder.cs index 2b8a85ea..1bd9fdbb 100644 --- a/source/System/Text/StringBuilder.cs +++ b/source/System/Text/StringBuilder.cs @@ -190,7 +190,7 @@ public unsafe StringBuilder(string value, int startIndex, int length, int capaci //Set the length of the chunk _chunkLength = length; //Copy the value to the chunkChars - value.ToCharArray().CopyTo(_chunkChars, 0); + value.ToCharArray(startIndex, length).CopyTo(_chunkChars, 0); } private StringBuilder(int size, int maxCapacity, StringBuilder previousBlock)