Author: atsushi
Date: 2006-01-20 03:51:53 -0500 (Fri, 20 Jan 2006)
New Revision: 55825
Modified:
trunk/mcs/class/I18N/CJK/CP949.cs
trunk/mcs/class/I18N/CJK/ChangeLog
trunk/mcs/class/I18N/CJK/Test/ChangeLog
trunk/mcs/class/I18N/CJK/Test/I18N.CJK.Test.cs
Log:
2006-01-20 Atsushi Enomoto <[EMAIL PROTECTED]>
* CP949.cs : GetChars() exactly the same fix as CP950.
Fixed bug #77298.
* I18N.CJK.Test.cs : fixed broken method extraction. Added test for
#77298.
Modified: trunk/mcs/class/I18N/CJK/CP949.cs
===================================================================
--- trunk/mcs/class/I18N/CJK/CP949.cs 2006-01-20 08:42:11 UTC (rev 55824)
+++ trunk/mcs/class/I18N/CJK/CP949.cs 2006-01-20 08:51:53 UTC (rev 55825)
@@ -185,7 +185,7 @@
else
ord = -1;
- if (ord >= 0)
+ if (ord >= 0 && ord * 2 <= convert.n2u.Length)
c1 = (char)(convert.n2u[ord*2] +
convert.n2u[ord*2 + 1] * 256);
else
@@ -202,7 +202,7 @@
else
ord = -1;
- if (ord >= 0)
+ if (ord >= 0 && ord * 2 < convert.n2u.Length)
c1 = (char)(convert.n2u[ord*2] +
convert.n2u[ord*2 + 1] * 256);
else
@@ -210,7 +210,8 @@
} else if (b >= 0xA1 && b <= 0xFE) { // KS X 1001
int ord = ((lastByte - 0xA1) * 94 + b - 0xA1) * 2;
- c1 = (char)(convert.n2u[ord] +
+ c1 = ord < 0 || ord >= convert.n2u.Length ?
+ '\0' : (char)(convert.n2u[ord] +
convert.n2u[ord + 1] * 256);
} else
c1 = (char)0;
@@ -271,7 +272,7 @@
else
ord = -1;
- if (ord >= 0)
+ if (ord >= 0 && ord * 2 <= convert.n2u.Length)
c1 = (char)(convert.n2u[ord*2] +
convert.n2u[ord*2 + 1] * 256);
else
@@ -288,7 +289,7 @@
else
ord = -1;
- if (ord >= 0)
+ if (ord >= 0 && ord * 2 <= convert.n2u.Length)
c1 = (char)(convert.n2u[ord*2] +
convert.n2u[ord*2 + 1] * 256);
else
@@ -296,7 +297,8 @@
} else if (b >= 0xA1 && b <= 0xFE) { // KS X 1001
int ord = ((lastByte - 0xA1) * 94 + b - 0xA1) * 2;
- c1 = (char)(convert.n2u[ord] +
+ c1 = ord < 0 || ord >= convert.n2u.Length ?
+ '\0' : (char)(convert.n2u[ord] +
convert.n2u[ord + 1] * 256);
} else
c1 = (char)0;
Modified: trunk/mcs/class/I18N/CJK/ChangeLog
===================================================================
--- trunk/mcs/class/I18N/CJK/ChangeLog 2006-01-20 08:42:11 UTC (rev 55824)
+++ trunk/mcs/class/I18N/CJK/ChangeLog 2006-01-20 08:51:53 UTC (rev 55825)
@@ -1,5 +1,10 @@
2006-01-20 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * CP949.cs : GetChars() exactly the same fix as CP950.
+ Fixed bug #77298.
+
+2006-01-20 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* CP950.cs : GetChars() should filter out invalid index to internal
conversion array. Fixed bug #77274.
Modified: trunk/mcs/class/I18N/CJK/Test/ChangeLog
===================================================================
--- trunk/mcs/class/I18N/CJK/Test/ChangeLog 2006-01-20 08:42:11 UTC (rev
55824)
+++ trunk/mcs/class/I18N/CJK/Test/ChangeLog 2006-01-20 08:51:53 UTC (rev
55825)
@@ -1,5 +1,10 @@
2006-01-20 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * I18N.CJK.Test.cs : fixed broken method extraction. Added test for
+ #77298.
+
+2006-01-20 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* I18N.CJK.Test.cs : added test for bug #77274. Unify those
"all pair of bytes" tests code.
Modified: trunk/mcs/class/I18N/CJK/Test/I18N.CJK.Test.cs
===================================================================
--- trunk/mcs/class/I18N/CJK/Test/I18N.CJK.Test.cs 2006-01-20 08:42:11 UTC
(rev 55824)
+++ trunk/mcs/class/I18N/CJK/Test/I18N.CJK.Test.cs 2006-01-20 08:51:53 UTC
(rev 55825)
@@ -208,7 +208,7 @@
e.GetBytes (new char [] {(char) i});
}
- GetCharsAllBytePairs (int enc)
+ void GetCharsAllBytePairs (int enc)
{
Encoding e = Encoding.GetEncoding (enc);
byte [] bytes = new byte [2];
@@ -234,8 +234,14 @@
}
[Test]
- public void Bug7774 ()
+ public void Bug77298 ()
{
+ GetCharsAllBytePairs (949);
+ }
+
+ [Test]
+ public void Bug77274 ()
+ {
GetCharsAllBytePairs (950);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches