[Mono-bugs] [Bug 464229] New: XmlReader.ReadElementContentAsBase64() hangs indefinitely and uses 100% CPU on the last read

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jan 7 14:02:15 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=464229


           Summary: XmlReader.ReadElementContentAsBase64() hangs
                    indefinitely and uses 100% CPU on the last read
           Product: Mono: Class Libraries
           Version: 2.0.x
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: jhurliman at metaverseindustries.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User


The following program will run to the end and print out "Done" in Windows under
NET (expected behavior according to MSDN documentation). I've tested this
program on Mono 1.9.1 Linux, Mono 1.9.1 Windows, and Mono 2.0.1 Windows and
each time the final call to XmlReader.ReadElementContentAsBase64() will hang
indefinitely and use 100% of the CPU time.


using System;
using System.IO;
using System.Xml;

namespace sandbox
{
    class Program
    {
        static void Main(string[] args)
        {
            Random rand = new Random();
            byte[] randomData = new byte[5000];
            rand.NextBytes(randomData);

            string xmlString = "<?xml version=\"1.0\"?><data>" +
Convert.ToBase64String(randomData) + "</data>";
            TextReader textReader = new StringReader(xmlString);
            XmlReader xmlReader = XmlReader.Create(textReader);
            xmlReader.ReadToFollowing("data");

            int readBytes = 0;
            byte[] buffer = new byte[1024];

            while ((readBytes = xmlReader.ReadElementContentAsBase64(buffer, 0,
buffer.Length)) > 0)
                Console.WriteLine("Read 1024 bytes");

            Console.WriteLine("Done");
        }
    }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list