diff options
author | jeffgoku <jeffreygoku@gmail.com> | 2020-08-31 16:08:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-31 16:08:58 +0300 |
commit | 30689421ab03de24eb41dbb736d2c0b78786dee2 (patch) | |
tree | 001bc9d4eee91bebb8619301f155a17f519d58e4 | |
parent | 728b1e92588ab897dcee142c541490ea200ba9b2 (diff) |
Fix potential crash for Encoder.Convert (#20271)
GetByteCount will not return the right number of bytes needed, so GetBytes in Encoder.Convert will crash for some input
-rw-r--r-- | mcs/class/I18N/CJK/GB18030Encoding.cs | 5 |
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) { |