Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

saxes

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

saxes - npm Package Compare versions

Comparing version 3.1.9 to 3.1.10

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="3.1.10"></a>
## [3.1.10](https://github.com/lddubeau/saxes/compare/v3.1.9...v3.1.10) (2019-06-11)
### Performance Improvements
* improve the check for ]]> in character data ([21df9b5](https://github.com/lddubeau/saxes/commit/21df9b5))
<a name="3.1.9"></a>

@@ -2,0 +12,0 @@ ## [3.1.9](https://github.com/lddubeau/saxes/compare/v3.1.7...v3.1.9) (2019-02-25)

49

lib/saxes.js

@@ -107,3 +107,2 @@ "use strict";

const TEXT_TERMINATOR = [LESS, AMP];
const DOCTYPE_TERMINATOR = [...QUOTES, OPEN_BRACKET, GREATER];

@@ -337,6 +336,2 @@ const DOCTYPE_DTD_TERMINATOR = [...QUOTES, CLOSE_BRACKET];

this.badEntityName = false;
// This records the index before which we don't have to check for the
// presence of ]]]>. The text before that index has been checked already,
// and should not be checked twice.
this.textCheckedBefore = 0;
const xmlnsOpt = this.xmlnsOpt = !!this.opt.xmlns;

@@ -791,3 +786,2 @@

this.text = String.fromCodePoint(c);
this.textCheckedBefore = 0;
this.state = S_TEXT;

@@ -800,6 +794,33 @@ this.xmlDeclPossible = false;

sText() {
const c = this.captureTo(TEXT_TERMINATOR, "text");
// This is essentially a specialized version of captureTo which is optimized
// for performing the ]]> check. A previous version of this code, checked
// ``this.text`` for the presence of ]]>. It simplified the code but was
// very costly when character data contained a lot of entities to be parsed.
const { chunk, limit, i: start } = this;
let c;
while (this.i < limit) {
const code = this.getCode();
if (code === LESS || code === AMP) {
c = code;
break;
}
}
// This is faster than adding codepoints one by one.
const slice = chunk.substring(start,
c === undefined ? undefined :
(this.i - (c <= 0xFFFF ? 1 : 2)));
// We test for the presence of ]]>, which is not allowed in CharData. We
// have to take into account edge conditions.
if (slice.includes("]]>") ||
(slice[0] === ">" && this.text.endsWith("]]")) ||
(slice.startsWith("]>") && this.text.endsWith("]"))) {
this.fail("the string \"]]>\" is disallowed in char data.");
}
this.text += slice;
if ((!this.sawRoot || this.closedRoot) &&
(/\S/.test(this.text) || c === AMP)) {
(/\S/.test(slice) || c === AMP)) {
// We use the reportedTextBeforeRoot and reportedTextAfterRoot flags

@@ -819,11 +840,2 @@ // to avoid reporting errors for every single character that is out of

if (this.text.includes("]]>", this.textCheckedBefore)) {
this.fail("the string \"]]>\" is disallowed in char data.");
}
// We have to go back two spaces so that we can catch the case where on a
// previous write call, the text buffer ended on ``]]`` and we started
// with ``>`` this time around.
this.textCheckedBefore = this.text.length - 2;
switch (c) {

@@ -1576,3 +1588,2 @@ case LESS:

}
this.textCheckedBefore = this.text.length;
this.entity = "";

@@ -1585,3 +1596,2 @@ this.state = this.entityReturnState;

this.text += `&${this.entity}${String.fromCodePoint(c)}`;
this.textCheckedBefore = this.text.length;
this.entity = "";

@@ -1633,3 +1643,2 @@ this.state = this.entityReturnState;

this.text = "";
this.textCheckedBefore = 0;
}

@@ -1636,0 +1645,0 @@

@@ -5,3 +5,3 @@ {

"author": "Louis-Dominique Dubeau <ldd@lddubeau.com>",
"version": "3.1.9",
"version": "3.1.10",
"main": "lib/saxes.js",

@@ -30,12 +30,12 @@ "types": "lib/saxes.d.ts",

"devDependencies": {
"@commitlint/cli": "^7.5.2",
"@commitlint/config-angular": "^7.5.0",
"@commitlint/cli": "^8.0.0",
"@commitlint/config-angular": "^8.0.0",
"chai": "^4.2.0",
"conventional-changelog-cli": "^2.0.12",
"eslint": "^5.14.1",
"eslint-config-lddubeau-base": "^3.0.1",
"husky": "^1.3.1",
"mocha": "^6.0.1",
"conventional-changelog-cli": "^2.0.21",
"eslint": "^5.16.0",
"eslint-config-lddubeau-base": "^3.0.3",
"husky": "^2.4.0",
"mocha": "^6.1.4",
"renovate-config-lddubeau": "^1.0.0",
"xml-conformance-suite": "^1.1.0"
"xml-conformance-suite": "^1.2.0"
},

@@ -42,0 +42,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc