Commit ca6f8652 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Throw exception when parsing invalid XML. JM-1421

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10646 b35dd754-fafc-0310-a699-88a17e54d16e
parent b398863a
...@@ -205,6 +205,10 @@ class XMLLightweightParser { ...@@ -205,6 +205,10 @@ class XMLLightweightParser {
boolean isHighSurrogate = false; boolean isHighSurrogate = false;
for (int i = 0; i < readByte; i++) { for (int i = 0; i < readByte; i++) {
ch = buf[i]; ch = buf[i];
if (ch < 0x20 && ch != 0x9 && ch != 0xA && ch != 0xD) {
//Unicode characters in the range 0x0000-0x001F other than 9, A, and D are not allowed in XML
throw new Exception("Disallowed character");
}
if (isHighSurrogate) { if (isHighSurrogate) {
if (Character.isLowSurrogate(ch)) { if (Character.isLowSurrogate(ch)) {
// Everything is fine. Clean up traces for surrogates // Everything is fine. Clean up traces for surrogates
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment