mirror of
https://github.com/stleary/JSON-java.git
synced 2026-05-19 00:00:46 -04:00
Validate XML numeric character references before string construction
This commit is contained in:
@@ -167,6 +167,9 @@ public class XMLTokener extends JSONTokener {
|
||||
int cp = (e.charAt(1) == 'x' || e.charAt(1) == 'X')
|
||||
? parseHexEntity(e)
|
||||
: parseDecimalEntity(e);
|
||||
if (XML.mustEscape(cp)) {
|
||||
throw new JSONException("Invalid numeric character reference: &#" + e.substring(1) + ";");
|
||||
}
|
||||
return new String(new int[] {cp}, 0, 1);
|
||||
}
|
||||
Character knownEntity = entity.get(e);
|
||||
|
||||
Reference in New Issue
Block a user