List Info

Thread: Possible xmlTextReaderRead() bug with improper XML




Possible xmlTextReaderRead() bug with improper XML
user name
2007-01-02 20:44:19

Hello,

We are using the xmlreader in our application, and when parsing a char buffer we get an error that says:

Entity: line 1: parser error : Document is empty
  <logquery />
^

The problem is that the <logquery/> element has a leading 0x0C character (I know that's a bad thing) but what surprised me is that xmlTextReaderRead() threw the Document is empty error, but it still returned ok, and we never exit our "while(xmlTextReaderRead(reader)" loop.  I would have expected that to throw an error and dump me out.  ;If someone gives me a pointer where to look in the xmlreader code, I'm happy to investigate it, but I'm not too familiar with the inner workings of libxml2.

Thanks,
Jim
Possible xmlTextReaderRead() bug with improper XML
user name
2007-01-02 21:50:28
On Tue, Jan 02, 2007 at 03:44:19PM -0500, jwertilstechnology.com wrote:
> Hello,
> 
> We are using the xmlreader in our application, and when
parsing a char 
> buffer we get an error that says:
> 
> Entity: line 1: parser error : Document is empty
>   <logquery />
> ^
> 
> The problem is that the <logquery/> element has a
leading 0x0C character 
> (I know that's a bad thing) but what surprised me is
that 
> xmlTextReaderRead() threw the Document is empty error,
but it still 
> returned ok, and we never exit our
"while(xmlTextReaderRead(reader)" loop. 
>  I would have expected that to throw an error and dump
me out.  If someone 
> gives me a pointer where to look in the xmlreader code,
I'm happy to 
> investigate it, but I'm not too familiar with the inner
workings of 
> libxml2.

  Best is to provide a copy of the document leading to the
problem. 
0x0C is forbidden, I don't see how this could not result in
a fatal error,
and the xmlTextReaderRead() will return -1 . Note that -1 is
non zero
so your loop will continue but you should only get -1 and no
data will
be available from that point. xmllint --stream parses with
the reader.

Daniel


-- 
Red Hat Virtualization group http://redhat.com/v
irtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillardredhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )