You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2003/08/01 15:59:10 UTC
DO NOT REPLY [Bug 22054] New: -
It's possible to create a text node with a null byte, resulting in erratic behavior
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22054>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22054
It's possible to create a text node with a null byte, resulting in erratic behavior
Summary: It's possible to create a text node with a null byte,
resulting in erratic behavior
Product: Xerces2-J
Version: 2.4.0
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Normal
Priority: Other
Component: DOM
AssignedTo: xerces-j-dev@xml.apache.org
ReportedBy: thomas@boerkel.de
This causes an exception (sounds correct to me):
DocumentBuilderFactory dbf;
DocumentBuilder db;
Document d;
Element root;
dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(true);
dbf.setAttribute("http://apache.org/xml/features/validation/dynamic",
new Boolean(true));
dbf.setAttribute("http://apache.org/xml/features/validation/schema",
new Boolean(true));
db = dbf.newDocumentBuilder();
d = db.parse(new InputSource(new StringReader("<root>Test\0</root>")));
This does not cause an exception:
DocumentBuilderFactory dbf;
DocumentBuilder db;
Document d;
Element root;
org.w3c.dom.Text text;
dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(true);
dbf.setAttribute("http://apache.org/xml/features/validation/dynamic",
new Boolean(true));
dbf.setAttribute("http://apache.org/xml/features/validation/schema",
new Boolean(true));
db = dbf.newDocumentBuilder();
d = db.newDocument();
root = d.createElement("root");
d.appendChild(root);
text = d.createTextNode("Test\0");
root.appendChild(text);
As a result, you have an incorrect XML. If you try to output it via the
serializer, you get the error.
In another case, where I do not have a small repro yet, it would encode the null
byte but destroy the XML.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org