node-opcua-binary-stream 2.176.0 → 2.180.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/binaryStream.d.ts +127 -1
- package/dist/binaryStream.js +259 -11
- package/dist/binaryStream.js.map +1 -1
- package/dist/binaryStreamSizeCalculator.d.ts +15 -9
- package/dist/binaryStreamSizeCalculator.js +22 -11
- package/dist/binaryStreamSizeCalculator.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/package.json +6 -6
- package/source/binaryStream.ts +305 -29
- package/source/binaryStreamSizeCalculator.ts +26 -14
- package/source/index.ts +2 -2
package/dist/binaryStream.d.ts
CHANGED
|
@@ -1,7 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node-opcua-binary-stream
|
|
3
3
|
*/
|
|
4
|
-
import "util";
|
|
4
|
+
import "node:util";
|
|
5
|
+
/**
|
|
6
|
+
* raised when a growable BinaryStream would have to exceed its declared maximum size.
|
|
7
|
+
*
|
|
8
|
+
* Distinct from every other encoding failure on purpose: a caller that sized the stream
|
|
9
|
+
* from a negotiated limit needs to tell "the peer's message is too big" apart from
|
|
10
|
+
* "the encoder is broken".
|
|
11
|
+
*/
|
|
12
|
+
export declare class BinaryStreamMaxSizeExceededError extends Error {
|
|
13
|
+
constructor(message: string);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* raised when a decoder descends past BinaryStream.maxNestingLevel while reading a
|
|
17
|
+
* recursive type (ExtensionObject, Variant, DiagnosticInfo).
|
|
18
|
+
*
|
|
19
|
+
* Distinct from a size error on purpose: a message can be well within its size limit yet
|
|
20
|
+
* still nest deeply enough to exhaust the call stack, so a caller needs to tell "the peer
|
|
21
|
+
* nested too deep" apart from "the message is too big".
|
|
22
|
+
*/
|
|
23
|
+
export declare class BinaryStreamMaxNestingLevelExceededError extends Error {
|
|
24
|
+
constructor(message: string);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* raised when a wire array length is refused before any element is decoded - it exceeds
|
|
28
|
+
* either BinaryStream.maxArrayLength or the number of bytes left to read.
|
|
29
|
+
*
|
|
30
|
+
* Named distinctly so a caller can map it to Bad_EncodingLimitsExceeded (Part 4 §5.3)
|
|
31
|
+
* rather than mistaking it for a genuine parse error.
|
|
32
|
+
*/
|
|
33
|
+
export declare class BinaryStreamArrayLengthExceededError extends Error {
|
|
34
|
+
constructor(message: string);
|
|
35
|
+
}
|
|
5
36
|
/**
|
|
6
37
|
* a BinaryStream can be use to perform sequential read or write
|
|
7
38
|
* inside a buffer.
|
|
@@ -26,8 +57,37 @@ import "util";
|
|
|
26
57
|
|
|
27
58
|
*/
|
|
28
59
|
export declare class BinaryStream {
|
|
60
|
+
#private;
|
|
29
61
|
static maxByteStringLength: number;
|
|
30
62
|
static maxStringLength: number;
|
|
63
|
+
/**
|
|
64
|
+
* how deep decoders may nest recursive types (ExtensionObject, Variant,
|
|
65
|
+
* DiagnosticInfo) while reading from this stream.
|
|
66
|
+
*
|
|
67
|
+
* These types can nest without ever making the message larger than the negotiated
|
|
68
|
+
* limit, so a message well under the size cap can still drive the decoder deep enough
|
|
69
|
+
* to exhaust the call stack. OPC UA Part 6 §5.1.8/§5.1.9 anticipates this and requires
|
|
70
|
+
* a decoder to support at least 100 levels and to report an error beyond what it
|
|
71
|
+
* supports; §5.2.2.12 says the same for the self-recursive DiagnosticInfo. One shared
|
|
72
|
+
* budget across the three types bounds what actually matters - total stack depth -
|
|
73
|
+
* regardless of how a message mixes them.
|
|
74
|
+
*
|
|
75
|
+
* Set to 128, comfortably above the 100 the spec requires us to support (so a message
|
|
76
|
+
* that legitimately nests 100 deep still decodes whichever way you count the outermost
|
|
77
|
+
* level) and far below the depth at which the call stack would actually overflow.
|
|
78
|
+
*/
|
|
79
|
+
static maxNestingLevel: number;
|
|
80
|
+
/**
|
|
81
|
+
* hard ceiling on the number of elements a single array length prefix may declare.
|
|
82
|
+
*
|
|
83
|
+
* The length is read straight off the wire as a UInt32, so without a ceiling a tiny
|
|
84
|
+
* message can declare billions of elements and drive the decoder to loop and allocate
|
|
85
|
+
* to match. Mirrors the cap the Variant value path has always enforced
|
|
86
|
+
* (Variant.maxArrayLength); the generic path that decodes every structured-type array
|
|
87
|
+
* field never had one. Adjustable so a deployment that legitimately exchanges larger
|
|
88
|
+
* arrays can raise it.
|
|
89
|
+
*/
|
|
90
|
+
static maxArrayLength: number;
|
|
31
91
|
/**
|
|
32
92
|
* the current position inside the buffer
|
|
33
93
|
*/
|
|
@@ -36,6 +96,46 @@ export declare class BinaryStream {
|
|
|
36
96
|
* @internal
|
|
37
97
|
*/
|
|
38
98
|
buffer: Buffer;
|
|
99
|
+
/**
|
|
100
|
+
* signal that the decoder is about to descend one level into a recursive type.
|
|
101
|
+
* Throws BinaryStreamMaxNestingLevelExceededError once the depth passes
|
|
102
|
+
* BinaryStream.maxNestingLevel, before the recursive call is made and before any
|
|
103
|
+
* further stack frame is consumed. Every successful call must be paired with
|
|
104
|
+
* exitNestingLevel, which is why callers use try/finally.
|
|
105
|
+
*/
|
|
106
|
+
enterNestingLevel(): void;
|
|
107
|
+
/**
|
|
108
|
+
* mark that the decoder has finished one level of a recursive type. Pair with a
|
|
109
|
+
* preceding successful enterNestingLevel via try/finally so the depth is restored
|
|
110
|
+
* even when the nested decode throws.
|
|
111
|
+
*/
|
|
112
|
+
exitNestingLevel(): void;
|
|
113
|
+
/**
|
|
114
|
+
* validate a wire array length before a decoder loops over it.
|
|
115
|
+
*
|
|
116
|
+
* Two independent bounds:
|
|
117
|
+
* - it may not exceed BinaryStream.maxArrayLength;
|
|
118
|
+
* - it may not exceed the bytes left in the stream, since every encoded element
|
|
119
|
+
* occupies at least one byte. This tight check alone rejects an implausible length
|
|
120
|
+
* (0x7FFFFFFE elements behind a 100-byte body) immediately, and also catches a
|
|
121
|
+
* length that sits under the ceiling yet is still far larger than the remaining
|
|
122
|
+
* payload can back.
|
|
123
|
+
*
|
|
124
|
+
* @param length the element count just read from the stream
|
|
125
|
+
*/
|
|
126
|
+
checkArrayLength(length: number): void;
|
|
127
|
+
/**
|
|
128
|
+
* create a stream that reallocates its buffer as needed, up to maxLength bytes.
|
|
129
|
+
*
|
|
130
|
+
* Encoding a message whose size is not known up front otherwise means encoding it
|
|
131
|
+
* twice: once into a BinaryStreamSizeCalculator to learn the length, then again for
|
|
132
|
+
* real. Both passes walk the whole object graph, and measuring shows the sizing pass
|
|
133
|
+
* costs about as much as the real one.
|
|
134
|
+
*
|
|
135
|
+
* @param initialSize starting capacity; a good guess avoids reallocation entirely
|
|
136
|
+
* @param maxLength hard ceiling - exceeding it throws BinaryStreamMaxSizeExceededError
|
|
137
|
+
*/
|
|
138
|
+
static createGrowable(initialSize: number, maxLength: number): BinaryStream;
|
|
39
139
|
constructor(data: undefined | Buffer | number);
|
|
40
140
|
/**
|
|
41
141
|
* set the cursor to the begining of the stream
|
|
@@ -84,6 +184,21 @@ export declare class BinaryStream {
|
|
|
84
184
|
* @param value the value to write
|
|
85
185
|
*/
|
|
86
186
|
writeDouble(value: number): void;
|
|
187
|
+
/**
|
|
188
|
+
* reserve room for a 32 bit unsigned integer whose value is not known yet,
|
|
189
|
+
* and return the position at which it can later be written with patchUInt32.
|
|
190
|
+
*
|
|
191
|
+
* This lets a length-prefixed body be written in a single pass: reserve the slot,
|
|
192
|
+
* encode the body, then patch in the byte count. The alternative - computing the
|
|
193
|
+
* size up front - means encoding the body twice, which compounds for nested
|
|
194
|
+
* structures.
|
|
195
|
+
*/
|
|
196
|
+
reserveUInt32(): number;
|
|
197
|
+
/**
|
|
198
|
+
* write a 32 bit unsigned integer at an absolute position previously returned by
|
|
199
|
+
* reserveUInt32, without moving the cursor.
|
|
200
|
+
*/
|
|
201
|
+
patchUInt32(position: number, value: number): void;
|
|
87
202
|
/**
|
|
88
203
|
* @param arrayBuf a buffer or byte array write
|
|
89
204
|
* @param offset the offset position (default =0)
|
|
@@ -147,6 +262,17 @@ export declare class BinaryStream {
|
|
|
147
262
|
readByteStream(): Buffer | null;
|
|
148
263
|
readString(): string | null;
|
|
149
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* resolve the (offset, length) arguments of writeArrayBuffer into a byte count.
|
|
267
|
+
*
|
|
268
|
+
* Shared by BinaryStream and BinaryStreamSizeCalculator so the two can never
|
|
269
|
+
* disagree: MessageChunker sizes a message with the calculator, allocates
|
|
270
|
+
* exactly that many bytes, then encodes with the stream. Any divergence here
|
|
271
|
+
* shows up as malformed chunk framing, not as a wrong number.
|
|
272
|
+
*
|
|
273
|
+
* @internal
|
|
274
|
+
*/
|
|
275
|
+
export declare function clampArrayBufferLength(byteLength: number, offset: number, length?: number): number;
|
|
150
276
|
/**
|
|
151
277
|
* @function calculateByteLength
|
|
152
278
|
* calculate the size in bytes of a utf8 string
|
package/dist/binaryStream.js
CHANGED
|
@@ -1,15 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BinaryStream = void 0;
|
|
3
|
+
exports.BinaryStream = exports.BinaryStreamArrayLengthExceededError = exports.BinaryStreamMaxNestingLevelExceededError = exports.BinaryStreamMaxSizeExceededError = void 0;
|
|
4
|
+
exports.clampArrayBufferLength = clampArrayBufferLength;
|
|
4
5
|
exports.calculateByteLength = calculateByteLength;
|
|
5
6
|
/**
|
|
6
7
|
* @module node-opcua-binary-stream
|
|
7
8
|
*/
|
|
8
|
-
require("util");
|
|
9
|
+
require("node:util");
|
|
9
10
|
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
10
|
-
const node_opcua_buffer_utils_1 = require("node-opcua-buffer-utils");
|
|
11
11
|
const MAXUINT32 = 4294967295; // 2**32 -1;
|
|
12
12
|
const performCheck = false;
|
|
13
|
+
/**
|
|
14
|
+
* raised when a growable BinaryStream would have to exceed its declared maximum size.
|
|
15
|
+
*
|
|
16
|
+
* Distinct from every other encoding failure on purpose: a caller that sized the stream
|
|
17
|
+
* from a negotiated limit needs to tell "the peer's message is too big" apart from
|
|
18
|
+
* "the encoder is broken".
|
|
19
|
+
*/
|
|
20
|
+
class BinaryStreamMaxSizeExceededError extends Error {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = "BinaryStreamMaxSizeExceededError";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.BinaryStreamMaxSizeExceededError = BinaryStreamMaxSizeExceededError;
|
|
27
|
+
/**
|
|
28
|
+
* raised when a decoder descends past BinaryStream.maxNestingLevel while reading a
|
|
29
|
+
* recursive type (ExtensionObject, Variant, DiagnosticInfo).
|
|
30
|
+
*
|
|
31
|
+
* Distinct from a size error on purpose: a message can be well within its size limit yet
|
|
32
|
+
* still nest deeply enough to exhaust the call stack, so a caller needs to tell "the peer
|
|
33
|
+
* nested too deep" apart from "the message is too big".
|
|
34
|
+
*/
|
|
35
|
+
class BinaryStreamMaxNestingLevelExceededError extends Error {
|
|
36
|
+
constructor(message) {
|
|
37
|
+
super(message);
|
|
38
|
+
this.name = "BinaryStreamMaxNestingLevelExceededError";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.BinaryStreamMaxNestingLevelExceededError = BinaryStreamMaxNestingLevelExceededError;
|
|
42
|
+
/**
|
|
43
|
+
* raised when a wire array length is refused before any element is decoded - it exceeds
|
|
44
|
+
* either BinaryStream.maxArrayLength or the number of bytes left to read.
|
|
45
|
+
*
|
|
46
|
+
* Named distinctly so a caller can map it to Bad_EncodingLimitsExceeded (Part 4 §5.3)
|
|
47
|
+
* rather than mistaking it for a genuine parse error.
|
|
48
|
+
*/
|
|
49
|
+
class BinaryStreamArrayLengthExceededError extends Error {
|
|
50
|
+
constructor(message) {
|
|
51
|
+
super(message);
|
|
52
|
+
this.name = "BinaryStreamArrayLengthExceededError";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.BinaryStreamArrayLengthExceededError = BinaryStreamArrayLengthExceededError;
|
|
13
56
|
/**
|
|
14
57
|
* a BinaryStream can be use to perform sequential read or write
|
|
15
58
|
* inside a buffer.
|
|
@@ -36,6 +79,34 @@ const performCheck = false;
|
|
|
36
79
|
class BinaryStream {
|
|
37
80
|
static maxByteStringLength = 16 * 1024 * 1024;
|
|
38
81
|
static maxStringLength = 16 * 1024 * 1024;
|
|
82
|
+
/**
|
|
83
|
+
* how deep decoders may nest recursive types (ExtensionObject, Variant,
|
|
84
|
+
* DiagnosticInfo) while reading from this stream.
|
|
85
|
+
*
|
|
86
|
+
* These types can nest without ever making the message larger than the negotiated
|
|
87
|
+
* limit, so a message well under the size cap can still drive the decoder deep enough
|
|
88
|
+
* to exhaust the call stack. OPC UA Part 6 §5.1.8/§5.1.9 anticipates this and requires
|
|
89
|
+
* a decoder to support at least 100 levels and to report an error beyond what it
|
|
90
|
+
* supports; §5.2.2.12 says the same for the self-recursive DiagnosticInfo. One shared
|
|
91
|
+
* budget across the three types bounds what actually matters - total stack depth -
|
|
92
|
+
* regardless of how a message mixes them.
|
|
93
|
+
*
|
|
94
|
+
* Set to 128, comfortably above the 100 the spec requires us to support (so a message
|
|
95
|
+
* that legitimately nests 100 deep still decodes whichever way you count the outermost
|
|
96
|
+
* level) and far below the depth at which the call stack would actually overflow.
|
|
97
|
+
*/
|
|
98
|
+
static maxNestingLevel = 128;
|
|
99
|
+
/**
|
|
100
|
+
* hard ceiling on the number of elements a single array length prefix may declare.
|
|
101
|
+
*
|
|
102
|
+
* The length is read straight off the wire as a UInt32, so without a ceiling a tiny
|
|
103
|
+
* message can declare billions of elements and drive the decoder to loop and allocate
|
|
104
|
+
* to match. Mirrors the cap the Variant value path has always enforced
|
|
105
|
+
* (Variant.maxArrayLength); the generic path that decodes every structured-type array
|
|
106
|
+
* field never had one. Adjustable so a deployment that legitimately exchanges larger
|
|
107
|
+
* arrays can raise it.
|
|
108
|
+
*/
|
|
109
|
+
static maxArrayLength = 1 * 1024 * 1024;
|
|
39
110
|
/**
|
|
40
111
|
* the current position inside the buffer
|
|
41
112
|
*/
|
|
@@ -44,12 +115,109 @@ class BinaryStream {
|
|
|
44
115
|
* @internal
|
|
45
116
|
*/
|
|
46
117
|
buffer;
|
|
118
|
+
/**
|
|
119
|
+
* 0 means "fixed size": the buffer is never reallocated and an overflowing write
|
|
120
|
+
* fails the same way it always has. A non-zero value turns the stream growable and
|
|
121
|
+
* caps how far it may grow. Kept as a single field so a fixed stream - the
|
|
122
|
+
* overwhelming majority - pays exactly one compare per write.
|
|
123
|
+
*/
|
|
124
|
+
#maxLength = 0;
|
|
125
|
+
/**
|
|
126
|
+
* current recursive-decode depth. Bumped by enterNestingLevel/exitNestingLevel as a
|
|
127
|
+
* decoder descends into nested ExtensionObject/Variant/DiagnosticInfo values.
|
|
128
|
+
*/
|
|
129
|
+
#nestingLevel = 0;
|
|
130
|
+
/**
|
|
131
|
+
* signal that the decoder is about to descend one level into a recursive type.
|
|
132
|
+
* Throws BinaryStreamMaxNestingLevelExceededError once the depth passes
|
|
133
|
+
* BinaryStream.maxNestingLevel, before the recursive call is made and before any
|
|
134
|
+
* further stack frame is consumed. Every successful call must be paired with
|
|
135
|
+
* exitNestingLevel, which is why callers use try/finally.
|
|
136
|
+
*/
|
|
137
|
+
enterNestingLevel() {
|
|
138
|
+
// Check before incrementing: a refused entry must leave the depth untouched.
|
|
139
|
+
// Callers put enterNestingLevel() outside their try/finally, so a throw here is
|
|
140
|
+
// never paired with an exitNestingLevel - incrementing first would leak a level
|
|
141
|
+
// every time the guard trips (e.g. when decodeExtensionObject swallows the throw)
|
|
142
|
+
// and slowly starve the budget for the rest of the message.
|
|
143
|
+
if (this.#nestingLevel >= BinaryStream.maxNestingLevel) {
|
|
144
|
+
throw new BinaryStreamMaxNestingLevelExceededError(`BinaryStream: maximum nesting level of ${BinaryStream.maxNestingLevel} exceeded while decoding a recursive type`);
|
|
145
|
+
}
|
|
146
|
+
this.#nestingLevel++;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* mark that the decoder has finished one level of a recursive type. Pair with a
|
|
150
|
+
* preceding successful enterNestingLevel via try/finally so the depth is restored
|
|
151
|
+
* even when the nested decode throws.
|
|
152
|
+
*/
|
|
153
|
+
exitNestingLevel() {
|
|
154
|
+
this.#nestingLevel--;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* validate a wire array length before a decoder loops over it.
|
|
158
|
+
*
|
|
159
|
+
* Two independent bounds:
|
|
160
|
+
* - it may not exceed BinaryStream.maxArrayLength;
|
|
161
|
+
* - it may not exceed the bytes left in the stream, since every encoded element
|
|
162
|
+
* occupies at least one byte. This tight check alone rejects an implausible length
|
|
163
|
+
* (0x7FFFFFFE elements behind a 100-byte body) immediately, and also catches a
|
|
164
|
+
* length that sits under the ceiling yet is still far larger than the remaining
|
|
165
|
+
* payload can back.
|
|
166
|
+
*
|
|
167
|
+
* @param length the element count just read from the stream
|
|
168
|
+
*/
|
|
169
|
+
checkArrayLength(length) {
|
|
170
|
+
if (length > BinaryStream.maxArrayLength) {
|
|
171
|
+
throw new BinaryStreamArrayLengthExceededError(`BinaryStream: array length ${length} exceeds the maximum allowed length of ${BinaryStream.maxArrayLength}`);
|
|
172
|
+
}
|
|
173
|
+
const remaining = this.buffer.length - this.length;
|
|
174
|
+
if (length > remaining) {
|
|
175
|
+
throw new BinaryStreamArrayLengthExceededError(`BinaryStream: array length ${length} exceeds the ${remaining} bytes remaining in the stream`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* create a stream that reallocates its buffer as needed, up to maxLength bytes.
|
|
180
|
+
*
|
|
181
|
+
* Encoding a message whose size is not known up front otherwise means encoding it
|
|
182
|
+
* twice: once into a BinaryStreamSizeCalculator to learn the length, then again for
|
|
183
|
+
* real. Both passes walk the whole object graph, and measuring shows the sizing pass
|
|
184
|
+
* costs about as much as the real one.
|
|
185
|
+
*
|
|
186
|
+
* @param initialSize starting capacity; a good guess avoids reallocation entirely
|
|
187
|
+
* @param maxLength hard ceiling - exceeding it throws BinaryStreamMaxSizeExceededError
|
|
188
|
+
*/
|
|
189
|
+
static createGrowable(initialSize, maxLength) {
|
|
190
|
+
const stream = new BinaryStream(Math.max(1, initialSize));
|
|
191
|
+
stream.#maxLength = maxLength;
|
|
192
|
+
return stream;
|
|
193
|
+
}
|
|
194
|
+
#ensure(n) {
|
|
195
|
+
if (this.#maxLength !== 0 && this.length + n > this.buffer.length) {
|
|
196
|
+
this.#grow(n);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
#grow(n) {
|
|
200
|
+
const needed = this.length + n;
|
|
201
|
+
if (needed > this.#maxLength) {
|
|
202
|
+
throw new BinaryStreamMaxSizeExceededError(`BinaryStream: cannot grow to ${needed} bytes, the maximum allowed size is ${this.#maxLength}`);
|
|
203
|
+
}
|
|
204
|
+
let newSize = this.buffer.length * 2;
|
|
205
|
+
while (newSize < needed) {
|
|
206
|
+
newSize *= 2;
|
|
207
|
+
}
|
|
208
|
+
if (newSize > this.#maxLength) {
|
|
209
|
+
newSize = this.#maxLength;
|
|
210
|
+
}
|
|
211
|
+
const bigger = Buffer.allocUnsafe(newSize);
|
|
212
|
+
this.buffer.copy(bigger, 0, 0, this.length);
|
|
213
|
+
this.buffer = bigger;
|
|
214
|
+
}
|
|
47
215
|
constructor(data) {
|
|
48
216
|
if (data === undefined) {
|
|
49
|
-
this.buffer =
|
|
217
|
+
this.buffer = Buffer.allocUnsafe(1024);
|
|
50
218
|
}
|
|
51
219
|
else if (typeof data === "number") {
|
|
52
|
-
this.buffer =
|
|
220
|
+
this.buffer = Buffer.allocUnsafe(data);
|
|
53
221
|
}
|
|
54
222
|
else {
|
|
55
223
|
(0, node_opcua_assert_1.assert)(data instanceof Buffer);
|
|
@@ -70,6 +238,7 @@ class BinaryStream {
|
|
|
70
238
|
* @param value the value to write
|
|
71
239
|
*/
|
|
72
240
|
writeInt8(value) {
|
|
241
|
+
this.#ensure(1);
|
|
73
242
|
// c8 ignore next
|
|
74
243
|
if (performCheck) {
|
|
75
244
|
(0, node_opcua_assert_1.assert)(this.buffer.length >= this.length + 1, "not enough space in buffer");
|
|
@@ -83,6 +252,7 @@ class BinaryStream {
|
|
|
83
252
|
* @param value the value to write
|
|
84
253
|
*/
|
|
85
254
|
writeUInt8(value) {
|
|
255
|
+
this.#ensure(1);
|
|
86
256
|
// c8 ignore next
|
|
87
257
|
if (performCheck) {
|
|
88
258
|
(0, node_opcua_assert_1.assert)(this.buffer.length >= this.length + 1, "not enough space in buffer");
|
|
@@ -96,6 +266,7 @@ class BinaryStream {
|
|
|
96
266
|
* @param value the value to write
|
|
97
267
|
*/
|
|
98
268
|
writeInt16(value) {
|
|
269
|
+
this.#ensure(2);
|
|
99
270
|
// c8 ignore next
|
|
100
271
|
if (performCheck) {
|
|
101
272
|
(0, node_opcua_assert_1.assert)(this.buffer.length >= this.length + 2, "not enough space in buffer");
|
|
@@ -108,6 +279,7 @@ class BinaryStream {
|
|
|
108
279
|
* @param value the value to write
|
|
109
280
|
*/
|
|
110
281
|
writeUInt16(value) {
|
|
282
|
+
this.#ensure(2);
|
|
111
283
|
// c8 ignore next
|
|
112
284
|
if (performCheck) {
|
|
113
285
|
(0, node_opcua_assert_1.assert)(this.buffer.length >= this.length + 2, "not enough space in buffer");
|
|
@@ -120,6 +292,7 @@ class BinaryStream {
|
|
|
120
292
|
* @param value the value to write
|
|
121
293
|
*/
|
|
122
294
|
writeInteger(value) {
|
|
295
|
+
this.#ensure(4);
|
|
123
296
|
// c8 ignore next
|
|
124
297
|
if (performCheck) {
|
|
125
298
|
(0, node_opcua_assert_1.assert)(this.buffer.length >= this.length + 4, "not enough space in buffer");
|
|
@@ -133,10 +306,11 @@ class BinaryStream {
|
|
|
133
306
|
* @param value the value to write
|
|
134
307
|
*/
|
|
135
308
|
writeUInt32(value) {
|
|
309
|
+
this.#ensure(4);
|
|
136
310
|
// c8 ignore next
|
|
137
311
|
if (performCheck) {
|
|
138
312
|
(0, node_opcua_assert_1.assert)(this.buffer.length >= this.length + 4, "not enough space in buffer");
|
|
139
|
-
(0, node_opcua_assert_1.assert)(isFinite(value));
|
|
313
|
+
(0, node_opcua_assert_1.assert)(Number.isFinite(value));
|
|
140
314
|
(0, node_opcua_assert_1.assert)(value >= 0 && value <= MAXUINT32);
|
|
141
315
|
}
|
|
142
316
|
this.buffer.writeUInt32LE(value, this.length);
|
|
@@ -153,6 +327,7 @@ class BinaryStream {
|
|
|
153
327
|
* @param value the value to write
|
|
154
328
|
*/
|
|
155
329
|
writeFloat(value) {
|
|
330
|
+
this.#ensure(4);
|
|
156
331
|
// c8 ignore next
|
|
157
332
|
if (performCheck) {
|
|
158
333
|
(0, node_opcua_assert_1.assert)(this.buffer.length >= this.length + 4, "not enough space in buffer");
|
|
@@ -165,6 +340,7 @@ class BinaryStream {
|
|
|
165
340
|
* @param value the value to write
|
|
166
341
|
*/
|
|
167
342
|
writeDouble(value) {
|
|
343
|
+
this.#ensure(8);
|
|
168
344
|
// c8 ignore next
|
|
169
345
|
if (performCheck) {
|
|
170
346
|
(0, node_opcua_assert_1.assert)(this.buffer.length >= this.length + 8, "not enough space in buffer");
|
|
@@ -172,21 +348,62 @@ class BinaryStream {
|
|
|
172
348
|
this.buffer.writeDoubleLE(value, this.length);
|
|
173
349
|
this.length += 8;
|
|
174
350
|
}
|
|
351
|
+
/**
|
|
352
|
+
* reserve room for a 32 bit unsigned integer whose value is not known yet,
|
|
353
|
+
* and return the position at which it can later be written with patchUInt32.
|
|
354
|
+
*
|
|
355
|
+
* This lets a length-prefixed body be written in a single pass: reserve the slot,
|
|
356
|
+
* encode the body, then patch in the byte count. The alternative - computing the
|
|
357
|
+
* size up front - means encoding the body twice, which compounds for nested
|
|
358
|
+
* structures.
|
|
359
|
+
*/
|
|
360
|
+
reserveUInt32() {
|
|
361
|
+
this.#ensure(4);
|
|
362
|
+
const position = this.length;
|
|
363
|
+
this.length += 4;
|
|
364
|
+
return position;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* write a 32 bit unsigned integer at an absolute position previously returned by
|
|
368
|
+
* reserveUInt32, without moving the cursor.
|
|
369
|
+
*/
|
|
370
|
+
patchUInt32(position, value) {
|
|
371
|
+
this.buffer.writeUInt32LE(value, position);
|
|
372
|
+
}
|
|
175
373
|
/**
|
|
176
374
|
* @param arrayBuf a buffer or byte array write
|
|
177
375
|
* @param offset the offset position (default =0)
|
|
178
376
|
* @param length the number of byte to write
|
|
179
377
|
*/
|
|
180
|
-
writeArrayBuffer(arrayBuf, offset = 0, length
|
|
378
|
+
writeArrayBuffer(arrayBuf, offset = 0, length) {
|
|
181
379
|
// c8 ignore next
|
|
182
380
|
if (performCheck) {
|
|
183
381
|
(0, node_opcua_assert_1.assert)(arrayBuf instanceof ArrayBuffer);
|
|
184
382
|
}
|
|
383
|
+
// note: for a real ArrayBuffer this is a zero-copy view. It also preserves the
|
|
384
|
+
// legacy shape where a caller passes a TypedArray instead: that takes the
|
|
385
|
+
// array-like constructor path and truncates element-wise, which some tests rely on.
|
|
185
386
|
const byteArr = new Uint8Array(arrayBuf);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
387
|
+
// `length` must default to "the rest of the buffer", not to the *whole* buffer:
|
|
388
|
+
// the old `length || byteArr.length` turned an explicit 0 into a full copy, and
|
|
389
|
+
// ignored `offset` when length was omitted.
|
|
390
|
+
const len = clampArrayBufferLength(byteArr.length, offset, length);
|
|
391
|
+
if (len === 0) {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
this.#ensure(len);
|
|
395
|
+
// make sure there is enough room in destination buffer
|
|
396
|
+
const remainingBytes = this.buffer.length - this.length;
|
|
397
|
+
/* c8 ignore next */
|
|
398
|
+
if (remainingBytes < len) {
|
|
399
|
+
throw new Error("BinaryStream.writeArrayBuffer error : not enough bytes left in buffer : requested is " +
|
|
400
|
+
len +
|
|
401
|
+
" but only " +
|
|
402
|
+
remainingBytes +
|
|
403
|
+
" left");
|
|
189
404
|
}
|
|
405
|
+
this.buffer.set(byteArr.subarray(offset, offset + len), this.length);
|
|
406
|
+
this.length += len;
|
|
190
407
|
}
|
|
191
408
|
// writeArrayBuffer(arrayBuf, offset, length) {
|
|
192
409
|
// offset = offset || 0;
|
|
@@ -284,6 +501,7 @@ class BinaryStream {
|
|
|
284
501
|
}
|
|
285
502
|
(0, node_opcua_assert_1.assert)(buf instanceof Buffer);
|
|
286
503
|
this.writeInteger(buf.length);
|
|
504
|
+
this.#ensure(buf.length);
|
|
287
505
|
// make sure there is enough room in destination buffer
|
|
288
506
|
const remainingBytes = this.buffer.length - this.length;
|
|
289
507
|
/* c8 ignore next */
|
|
@@ -307,6 +525,7 @@ class BinaryStream {
|
|
|
307
525
|
if (byteLength === 0) {
|
|
308
526
|
return;
|
|
309
527
|
}
|
|
528
|
+
this.#ensure(byteLength);
|
|
310
529
|
// make sure there is enough room in destination buffer
|
|
311
530
|
const remainingBytes = this.buffer.length - this.length;
|
|
312
531
|
/* c8 ignore next */
|
|
@@ -419,6 +638,35 @@ class BinaryStream {
|
|
|
419
638
|
}
|
|
420
639
|
}
|
|
421
640
|
exports.BinaryStream = BinaryStream;
|
|
641
|
+
/**
|
|
642
|
+
* resolve the (offset, length) arguments of writeArrayBuffer into a byte count.
|
|
643
|
+
*
|
|
644
|
+
* Shared by BinaryStream and BinaryStreamSizeCalculator so the two can never
|
|
645
|
+
* disagree: MessageChunker sizes a message with the calculator, allocates
|
|
646
|
+
* exactly that many bytes, then encodes with the stream. Any divergence here
|
|
647
|
+
* shows up as malformed chunk framing, not as a wrong number.
|
|
648
|
+
*
|
|
649
|
+
* @internal
|
|
650
|
+
*/
|
|
651
|
+
function clampArrayBufferLength(byteLength, offset, length) {
|
|
652
|
+
// A negative offset would make `available` larger than the source, and
|
|
653
|
+
// TypedArray#subarray reads a negative start as an offset from the *end* - so the
|
|
654
|
+
// caller would advance the cursor by more bytes than were actually copied, leaving
|
|
655
|
+
// a window of untouched destination memory inside the stream. Reject it here, in
|
|
656
|
+
// the one place both the stream and the size calculator agree on.
|
|
657
|
+
if (!(offset >= 0)) {
|
|
658
|
+
throw new Error(`BinaryStream.writeArrayBuffer: offset must be a non-negative number, got ${offset}`);
|
|
659
|
+
}
|
|
660
|
+
const available = byteLength - offset;
|
|
661
|
+
if (available <= 0) {
|
|
662
|
+
return 0;
|
|
663
|
+
}
|
|
664
|
+
const requested = length === undefined ? available : length;
|
|
665
|
+
if (requested <= 0) {
|
|
666
|
+
return 0;
|
|
667
|
+
}
|
|
668
|
+
return requested < available ? requested : available;
|
|
669
|
+
}
|
|
422
670
|
/**
|
|
423
671
|
* @function calculateByteLength
|
|
424
672
|
* calculate the size in bytes of a utf8 string
|
|
@@ -443,5 +691,5 @@ function calculateByteLength(str) {
|
|
|
443
691
|
}
|
|
444
692
|
return s;
|
|
445
693
|
}
|
|
446
|
-
const zeroLengthBuffer =
|
|
694
|
+
const zeroLengthBuffer = Buffer.allocUnsafe(0);
|
|
447
695
|
//# sourceMappingURL=binaryStream.js.map
|
package/dist/binaryStream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binaryStream.js","sourceRoot":"","sources":["../source/binaryStream.ts"],"names":[],"mappings":";;;AA6cA,kDAgBC;AA7dD;;GAEG;AACH,gBAAc;AAEd,yDAA2C;AAC3C,qEAAwE;AAExE,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,YAAY;AAC1C,MAAM,YAAY,GAAG,KAAK,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,YAAY;IACd,MAAM,CAAC,mBAAmB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IAC9C,MAAM,CAAC,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IACjD;;OAEG;IACI,MAAM,CAAS;IAEtB;;OAEG;IACI,MAAM,CAAS;IAEtB,YAAY,IAAiC;QACzC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,IAAI,CAAC,MAAM,GAAG,IAAA,uDAA6B,EA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S,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5D,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,GAAW;IAC3C,4CAA4C;IAC5C,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;YAC/B,CAAC,EAAE,CAAC;QACR,CAAC;aAAM,IAAI,IAAI,GAAG,KAAK,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;YACxC,CAAC,IAAI,CAAC,CAAC;QACX,CAAC;QACD,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;YACnC,kBAAkB;YAClB,CAAC,EAAE,CAAC;QACR,CAAC;IACL,CAAC;IACD,OAAO,CAAC,CAAC;AACb,CAAC;AAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -14,15 +14,21 @@ export declare class BinaryStreamSizeCalculator {
|
|
|
14
14
|
length: number;
|
|
15
15
|
constructor();
|
|
16
16
|
rewind(): void;
|
|
17
|
-
writeInt8(
|
|
18
|
-
writeUInt8(
|
|
19
|
-
writeInt16(
|
|
20
|
-
writeInteger(
|
|
21
|
-
writeUInt32(
|
|
22
|
-
writeUInt16(
|
|
23
|
-
writeFloat(
|
|
24
|
-
writeDouble(
|
|
25
|
-
|
|
17
|
+
writeInt8(_value: number): void;
|
|
18
|
+
writeUInt8(_value: number): void;
|
|
19
|
+
writeInt16(_value: number): void;
|
|
20
|
+
writeInteger(_value: number): void;
|
|
21
|
+
writeUInt32(_value: number): void;
|
|
22
|
+
writeUInt16(_value: number): void;
|
|
23
|
+
writeFloat(_value: number): void;
|
|
24
|
+
writeDouble(_value: number): void;
|
|
25
|
+
/**
|
|
26
|
+
* counterpart of BinaryStream.reserveUInt32: only the 4 reserved bytes matter here.
|
|
27
|
+
* The returned position is meaningless for a calculator - patchUInt32 ignores it.
|
|
28
|
+
*/
|
|
29
|
+
reserveUInt32(): number;
|
|
30
|
+
patchUInt32(_position: number, _value: number): void;
|
|
31
|
+
writeArrayBuffer(arrayBuf: ArrayBuffer, offset?: number, byteLength?: number): void;
|
|
26
32
|
writeByteStream(buf: Buffer): void;
|
|
27
33
|
writeString(str: null | string): void;
|
|
28
34
|
}
|