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.1 to 3.1.2

11

CHANGELOG.md

@@ -0,1 +1,12 @@

<a name="3.1.2"></a>
## [3.1.2](https://github.com/lddubeau/saxes/compare/v3.1.1...v3.1.2) (2018-08-31)
### Bug Fixes
* CDATA end in attributes must not cause an error ([a7495ac](https://github.com/lddubeau/saxes/commit/a7495ac))
* normalize \r\n and \r followed by something else to \n ([d7b1abe](https://github.com/lddubeau/saxes/commit/d7b1abe)), closes [#2](https://github.com/lddubeau/saxes/issues/2)
<a name="3.1.1"></a>

@@ -2,0 +13,0 @@ ## [3.1.1](https://github.com/lddubeau/saxes/compare/v3.1.0...v3.1.1) (2018-08-29)

70

lib/saxes.js

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

const NL = 0xA;
const CR = 0xD;
const SPACE = 0x20;

@@ -109,3 +110,3 @@ const BANG = 0x21;

const QUOTES = [DQUOTE, SQUOTE];
const S = [SPACE, NL, 0xD, 9];
const S = [SPACE, NL, CR, 9];

@@ -310,2 +311,3 @@ const TEXT_TERMINATOR = [LESS, AMP];

this.i = 0;
this.trailingCR = false;
/**

@@ -485,5 +487,9 @@ * A map of entity name to expansion.

}
let end = false;
if (chunk === null) {
return this.end();
end = true;
chunk = "";
}
if (typeof chunk === "object") {

@@ -498,3 +504,19 @@ chunk = chunk.toString();

// ``Array.from`` but don't want to be dependent on Node.)
const limit = this.limit = chunk.length;
let limit = chunk.length;
if (this.trailingCR) {
// The previous chunk had a trailing cr. We need to handle it now.
chunk = `\r${chunk}`;
}
if (!end && chunk[limit - 1] === CR) {
// The chunk ends with a trailing CR. We cannot know how to handle it
// until we get the next chunk or the end of the stream. So save it for
// later.
limit--;
this.trailingCR = true;
}
this.limit = limit;
this.chunk = chunk;

@@ -507,3 +529,3 @@ this.i = 0;

return this;
return end ? this.end() : this;
}

@@ -530,3 +552,4 @@

getCode() {
const { chunk, i } = this;
const { chunk } = this;
let { i } = this;
// Using charCodeAt and handling the surrogates ourselves is faster

@@ -537,12 +560,16 @@ // than using codePointAt.

if (code >= 0xD800 && code <= 0xDBFF) {
skip = 2;
code = 0x10000 + ((code - 0xD800) * 0x400) +
(chunk.charCodeAt(i + 1) - 0xDC00);
}
if (code === CR) {
// We may get undefined if we read past the end of the chunk, which is
// fine.
const next = chunk.charCodeAt(i + 1);
if (next === NL) {
// A \r\n sequence is converted to \n so we have to skip over the next
// character. We already know it has a size of 1 so ++ is fine here.
i++;
}
// Otherwise, a \r is just converted to \n, so we don't have to skip
// ahead.
this.i = i + skip;
if (!isChar(code)) {
this.fail("disallowed character.");
// In either case, \r becomes \n.
code = NL;
}

@@ -555,5 +582,17 @@

else {
if (code >= 0xD800 && code <= 0xDBFF) {
skip = 2;
code = 0x10000 + ((code - 0xD800) * 0x400) +
(chunk.charCodeAt(i + 1) - 0xDC00);
}
this.column += skip;
if (!isChar(code)) {
this.fail("disallowed character.");
}
}
this.i = i + skip;
return code;

@@ -1396,5 +1435,2 @@ }

else if (c) {
if (this.attribValue.includes("]]>")) {
this.fail("the string \"]]>\" is disallowed in char data.");
}
this.attribList.push({ name: this.name, value: this.attribValue });

@@ -1401,0 +1437,0 @@ this.name = this.attribValue = "";

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

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

@@ -8,0 +8,0 @@ "types": "lib/saxes.d.ts",

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