[Mono-bugs] [Bug 59648][Wis] New - UTF8Encoding.GetChars() fils for some byte data

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 6 Jun 2004 06:07:31 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by atsushi@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=59648

--- shadow/59648	2004-06-06 06:07:31.000000000 -0400
+++ shadow/59648.tmp.24987	2004-06-06 06:07:31.000000000 -0400
@@ -0,0 +1,51 @@
+Bug#: 59648
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: atsushi@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: UTF8Encoding.GetChars() fils for some byte data
+
+UTF8Encoding.GetChars() fails to read the sequence of data shown below:
+
+using System;
+using System.IO;
+using System.Text;
+
+public class Test
+{
+	public static void Main ()
+	{
+		byte [] data = new byte [] {0xc1, 0x81, 0x00, 0x00, 0x20};
+		char [] chars = new char [5];
+		Encoding e = Encoding.UTF8;
+		e.GetChars (data, 0, 5, chars, 0);
+	}
+}
+
+
+Actual Results:
+$ mono --debug test.exe
+
+Unhandled Exception: System.ArgumentException: Overlong
+Parameter name: 65
+in <0x00541> System.Text.UTF8Encoding:InternalGetChars
+(byte[],int,int,char[],int,uint&,uint&,bool,bool)
+in <0x0003d> System.Text.UTF8Encoding:GetChars (byte[],int,int,char[],int)
+in [0x00037] (at C:\cygwin\home\ginga\tests\nyoki\test.cs:13) Test:Main ()
+
+Expected Results:
+It successfully runs under MS.NET
+
+How often does this happen? 
+always