Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonojenkins <jo.shields+jenkins@xamarin.com>2020-10-28 13:54:00 +0300
committerGitHub <noreply@github.com>2020-10-28 13:54:00 +0300
commita22ed3f094e18f1f82e1c6cead28d872d3c57e40 (patch)
tree968106406ab977121352e026e280c7d4df9abb93
parent970783731fccf269dcc3d2385bfd4adadf172196 (diff)
Fix potential crash for Encoder.Convert (#20522)mono-6.12.0.107
GetByteCount will not return the right number of bytes needed, so GetBytes in Encoder.Convert will crash for some input Backport of #20271. Co-authored-by: jeffgoku <jeffreygoku@gmail.com>
-rw-r--r--mcs/class/I18N/CJK/GB18030Encoding.cs5
1 files changed, 2 insertions, 3 deletions
diff --git a/mcs/class/I18N/CJK/GB18030Encoding.cs b/mcs/class/I18N/CJK/GB18030Encoding.cs
index f62121e81f0..6f21c253475 100644
--- a/mcs/class/I18N/CJK/GB18030Encoding.cs
+++ b/mcs/class/I18N/CJK/GB18030Encoding.cs
@@ -430,10 +430,9 @@ namespace I18N.CJK
}
#else
- public override int GetByteCount(char[] chars, int index, int count, bool refresh)
+ public override int GetByteCount(char[] chars, int start, int count, bool refresh)
{
- int start = 0;
- int end = count;
+ int end = start + count;
int ret = 0;
while (start < end)
{