node-opcua-binary-stream
Advanced tools
Comparing version 2.71.0 to 2.73.0
@@ -35,2 +35,4 @@ /// <reference types="node" /> | ||
export declare class BinaryStream { | ||
static maxByteStringLength: number; | ||
static maxStringLength: number; | ||
/** | ||
@@ -37,0 +39,0 @@ * the current position inside the buffer |
@@ -330,2 +330,5 @@ "use strict"; | ||
readArrayBuffer(length) { | ||
if (length > BinaryStream.maxByteStringLength) { | ||
throw new Error(`maxStringLength(${BinaryStream.maxByteStringLength}) has been exceeded in BinaryStream.readArrayBuffer len=${length}`); | ||
} | ||
// istanbul ignore next | ||
@@ -335,3 +338,3 @@ if (performCheck) { | ||
} | ||
const slice = this.buffer.slice(this.length, this.length + length); | ||
const slice = this.buffer.subarray(this.length, this.length + length); | ||
// istanbul ignore next | ||
@@ -363,2 +366,5 @@ if (performCheck) { | ||
} | ||
if (bufLen > BinaryStream.maxByteStringLength) { | ||
throw new Error(`maxStringLength(${BinaryStream.maxByteStringLength}) has been exceeded in BinaryStream.readArrayBuffer len=${bufLen}`); | ||
} | ||
// check that there is enough space in the buffer | ||
@@ -375,3 +381,3 @@ const remainingBytes = this.buffer.length - this.length; | ||
// create a shared memory buffer ! for speed | ||
const buf = this.buffer.slice(this.length, this.length + bufLen); | ||
const buf = this.buffer.subarray(this.length, this.length + bufLen); | ||
this.length += bufLen; | ||
@@ -388,2 +394,5 @@ return buf; | ||
} | ||
if (bufLen > BinaryStream.maxStringLength) { | ||
throw new Error(`maxStringLength(${BinaryStream.maxStringLength}) has been exceeded in BinaryStream.readString len=${bufLen}`); | ||
} | ||
// check that there is enough space in the buffer | ||
@@ -405,2 +414,4 @@ const remainingBytes = this.buffer.length - this.length; | ||
exports.BinaryStream = BinaryStream; | ||
BinaryStream.maxByteStringLength = 16 * 1024 * 1024; | ||
BinaryStream.maxStringLength = 16 * 1024; | ||
/** | ||
@@ -407,0 +418,0 @@ * @function calculateByteLength |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "node-opcua-binary-stream", | ||
"version": "2.71.0", | ||
"version": "2.73.0", | ||
"description": "pure nodejs OPCUA SDK - module -binary-stream", | ||
@@ -36,3 +36,3 @@ "main": "./dist/index.js", | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "10f7cc1e1cd30dfef75adad9cb709a78401fabf3" | ||
"gitHead": "b23a87c1ef777c0d8b680f45ee77e2a319feb092" | ||
} |
@@ -42,2 +42,4 @@ /** | ||
export class BinaryStream { | ||
public static maxByteStringLength = 16 * 1024 * 1024; | ||
public static maxStringLength = 16 * 1024; | ||
/** | ||
@@ -367,2 +369,5 @@ * the current position inside the buffer | ||
public readArrayBuffer(length: number): Uint8Array { | ||
if (length > BinaryStream.maxByteStringLength) { | ||
throw new Error(`maxStringLength(${BinaryStream.maxByteStringLength}) has been exceeded in BinaryStream.readArrayBuffer len=${length}`); | ||
} | ||
// istanbul ignore next | ||
@@ -372,3 +377,3 @@ if (performCheck) { | ||
} | ||
const slice = this.buffer.slice(this.length, this.length + length); | ||
const slice = this.buffer.subarray(this.length, this.length + length); | ||
// istanbul ignore next | ||
@@ -401,2 +406,5 @@ if (performCheck) { | ||
} | ||
if (bufLen > BinaryStream.maxByteStringLength) { | ||
throw new Error(`maxStringLength(${BinaryStream.maxByteStringLength}) has been exceeded in BinaryStream.readArrayBuffer len=${bufLen}`); | ||
} | ||
// check that there is enough space in the buffer | ||
@@ -415,3 +423,3 @@ const remainingBytes = this.buffer.length - this.length; | ||
// create a shared memory buffer ! for speed | ||
const buf = this.buffer.slice(this.length, this.length + bufLen); | ||
const buf = this.buffer.subarray(this.length, this.length + bufLen); | ||
this.length += bufLen; | ||
@@ -429,2 +437,5 @@ return buf; | ||
} | ||
if (bufLen > BinaryStream.maxStringLength) { | ||
throw new Error(`maxStringLength(${BinaryStream.maxStringLength}) has been exceeded in BinaryStream.readString len=${bufLen}`); | ||
} | ||
// check that there is enough space in the buffer | ||
@@ -431,0 +442,0 @@ const remainingBytes = this.buffer.length - this.length; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55547
1252