[Mono-bugs] [Bug 480066] New: XmlReader.ReadContentAsBase64() causes the next call to XmlReader.Read() to read too many nodes

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Feb 26 15:03:48 EST 2009


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


           Summary: XmlReader.ReadContentAsBase64() causes the next call
                    to XmlReader.Read() to read too many nodes
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: dmitchell at logos.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us)
AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1

Here's some code:

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

public static class Program
{
    public static void Main()
    {
        StringReader readerString = new
StringReader("<root><b64>TWFu</b64><b64>TWFu</b64>\r\n\t<b64>TWFu</b64><b64>TWFu</b64></root>");
        XmlReaderSettings settingsXml = new XmlReaderSettings();
        settingsXml.XmlResolver = null;
        using (var readerXml = XmlReader.Create(readerString, settingsXml))
        {
            readerXml.MoveToContent();
            readerXml.Read();
            readerXml.ReadStartElement("b64");
            const int bufferLength = 64 * 1024;
            byte[] buffer = new byte[bufferLength];
            readerXml.ReadContentAsBase64(buffer, 0, bufferLength);
            readerXml.Read();
            Console.WriteLine(readerXml.NodeType);
        }
    }
}
---
Compiling/running under Microsoft's implementation produces the expected output
"Element", but Mono produces the output "Text" (it reads an extra node).

Reproducible: Always

Steps to Reproduce:
1. Compile the included code
2. Run
3.
Actual Results:  
The string "Text" is output

Expected Results:  
The string "Element" should be output

replacing the call to ReadContentAsBase64() with a call to ReadString() causes
the code to perform appropriately, so the problem appears to be peculiar to
ReadContentAsBase64().

-- 
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