http://bugzilla.novell.com/show_bug.cgi?id=610416
http://bugzilla.novell.com/show_bug.cgi?id=610416#c0 Summary: ArgumentException when calling Encoding.GetString (UTF8) Classification: Mono Product: Mono: Class Libraries Version: 2.4.x Platform: Other OS/Version: Linux Status: NEW Severity: Normal Priority: P5 - None Component: System AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- Created an attachment (id=365893) --> (http://bugzilla.novell.com/attachment.cgi?id=365893) The file which contains the bytes I passed to Encoding.GetString User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3 An argument exception occurs when a big byte array (in my case red from a odt document) is given to Encoding.GetString (Utf8 encoding) Testing the same thing under MS.NET doesn't fail. Reproducible: Always Steps to Reproduce: 1. Use this small program: using System; using System.IO; using System.Text; namespace EncodingTest { class MainClass { public static void Main (string[] args) { var bytes = File.ReadAllBytes ("use_cases.odt"); var encoding = Encoding.UTF8; Console.WriteLine (encoding.GetString (bytes)); } } } 2. Compile it and put the attached odt file in the same dir as the exe file 3. Run the program from where the exe lies. Actual Results: This exception: Unhandled Exception: System.ArgumentException: Arg_InsufficientSpace Parameter name: chars at System.Text.UTF8Encoding.InternalGetChars (System.Byte* bytes, Int32 byteCount, System.Char* chars, Int32 charCount, System.UInt32& leftOverBits, System.UInt32& leftOverCount, System.Object provider, System.Text.DecoderFallbackBuffer& fallbackBuffer, System.Byte[]& bufferArg, Boolean flush) [0x00000] at System.Text.UTF8Encoding.InternalGetChars (System.Byte[] bytes, Int32 byteIndex, Int32 byteCount, System.Char[] chars, Int32 charIndex, System.UInt32& leftOverBits, System.UInt32& leftOverCount, System.Object provider, System.Text.DecoderFallbackBuffer& fallbackBuffer, System.Byte[]& bufferArg, Boolean flush) [0x00000] at System.Text.UTF8Encoding.GetChars (System.Byte[] bytes, Int32 byteIndex, Int32 byteCount, System.Char[] chars, Int32 charIndex) [0x00000] at System.Text.Encoding.GetChars (System.Byte[] bytes, Int32 index, Int32 count) [0x00000] at System.Text.Encoding.GetString (System.Byte[] bytes, Int32 index, Int32 count) [0x00000] at System.Text.UTF8Encoding.GetString (System.Byte[] bytes, Int32 index, Int32 count) [0x00000] at System.Text.Encoding.GetString (System.Byte[] bytes) [0x00000] at EncodingTest.MainClass.Main (System.String[] args) [0x00000] Expected Results: A string should be returned (printed with the example program) Mono JIT compiler version 2.4.4 (Debian 2.4.4~svn151842-1ubuntu4) Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com TLS: __thread GC: Included Boehm (with typed GC) SIGSEGV: altstack Notifications: epoll Architecture: x86 Disabled: none -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
