mirror of
https://github.com/GNOME/libxml2.git
synced 2025-03-31 19:10:28 +08:00
fixed a limit case problem with "<a/>" Daniel
* xmlreader.c python/tests/reader.py: fixed a limit case problem with "<a/>" Daniel
This commit is contained in:
parent
ecaba49a72
commit
aaa105b590
@ -1,3 +1,8 @@
|
||||
Mon Dec 30 12:39:55 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* xmlreader.c python/tests/reader.py: fixed a limit case problem
|
||||
with "<a/>"
|
||||
|
||||
Mon Dec 30 11:53:44 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* SAX.c: warn on xmlns:prefix="foo"
|
||||
|
@ -301,6 +301,28 @@ if reader.NamespaceUri() != "http://www.w3.org/2000/xmlns/" or \
|
||||
print "test7: failed to read the namespace node"
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# Test for a limit case:
|
||||
#
|
||||
f = StringIO.StringIO("""<a/>""")
|
||||
input = libxml2.inputBuffer(f)
|
||||
reader = input.newTextReader("test8")
|
||||
ret = reader.Read()
|
||||
if ret != 1:
|
||||
print "test8: failed to read the node"
|
||||
sys.exit(1)
|
||||
if reader.Name() != "a" or reader.IsEmptyElement() != 1:
|
||||
print "test8: failed to analyze the node"
|
||||
sys.exit(1)
|
||||
ret = reader.Read()
|
||||
if ret != 0:
|
||||
print "test8: failed to detect the EOF"
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
#
|
||||
# cleanup for memory allocation counting
|
||||
#
|
||||
del f
|
||||
del input
|
||||
del reader
|
||||
|
@ -264,7 +264,9 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
|
||||
if (val <= 0) {
|
||||
reader->mode = XML_TEXTREADER_MODE_EOF;
|
||||
reader->state = oldstate;
|
||||
return(val);
|
||||
if ((oldstate != XML_TEXTREADER_START) ||
|
||||
(reader->ctxt->myDoc != NULL))
|
||||
return(val);
|
||||
}
|
||||
} else
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user