From 30fb540fd54d43f4fb349ff820a1b786d0fecaf3 Mon Sep 17 00:00:00 2001 From: Louis-Dominique Dubeau Date: Tue, 3 Jul 2018 19:11:04 -0400 Subject: [PATCH] fix: raise error on character reference outside CHAR production --- lib/saxes.js | 2 +- test/conformance.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/saxes.js b/lib/saxes.js index 64886589..8d27c75f 100644 --- a/lib/saxes.js +++ b/lib/saxes.js @@ -1036,7 +1036,7 @@ class SAXParser { } } - if (Number.isNaN(num)) { + if (Number.isNaN(num) || num > 0x10FFFF) { this.fail("Invalid character entity"); return `&${this.entity};`; } diff --git a/test/conformance.js b/test/conformance.js index 9d7740cb..e5fe1fd6 100644 --- a/test/conformance.js +++ b/test/conformance.js @@ -29,7 +29,8 @@ class SaxesDriver extends BaseDriver { errors.push(err); }; - parser.close(source); + parser.write(source); + parser.end(); this.processResult(test, handling, errors.length === 0); }); }