+15
-32
@@ -80,2 +80,3 @@ 'use strict'; | ||
| this._messageLength = 0; | ||
| this._numFragments = 0; | ||
| this._fragments = []; | ||
@@ -504,2 +505,15 @@ | ||
| if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) { | ||
| const error = this.createError( | ||
| RangeError, | ||
| 'Too many message fragments', | ||
| false, | ||
| 1008, | ||
| 'WS_ERR_TOO_MANY_BUFFERED_PARTS' | ||
| ); | ||
| cb(error); | ||
| return; | ||
| } | ||
| if (this._compressed) { | ||
@@ -512,18 +526,2 @@ this._state = INFLATING; | ||
| if (data.length) { | ||
| if ( | ||
| this._maxFragments > 0 && | ||
| this._fragments.length >= this._maxFragments | ||
| ) { | ||
| const error = this.createError( | ||
| RangeError, | ||
| 'Too many message fragments', | ||
| false, | ||
| 1008, | ||
| 'WS_ERR_TOO_MANY_BUFFERED_PARTS' | ||
| ); | ||
| cb(error); | ||
| return; | ||
| } | ||
| // | ||
@@ -568,18 +566,2 @@ // This message is not compressed so its length is the sum of the payload | ||
| if ( | ||
| this._maxFragments > 0 && | ||
| this._fragments.length >= this._maxFragments | ||
| ) { | ||
| const error = this.createError( | ||
| RangeError, | ||
| 'Too many message fragments', | ||
| false, | ||
| 1008, | ||
| 'WS_ERR_TOO_MANY_BUFFERED_PARTS' | ||
| ); | ||
| cb(error); | ||
| return; | ||
| } | ||
| this._fragments.push(buf); | ||
@@ -611,2 +593,3 @@ } | ||
| this._fragmented = 0; | ||
| this._numFragments = 0; | ||
| this._fragments = []; | ||
@@ -613,0 +596,0 @@ |
@@ -46,5 +46,5 @@ /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$", "caughtErrors": "none" }] */ | ||
| * @param {String} [options.host] The hostname where to bind the server | ||
| * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of | ||
| * @param {Number} [options.maxBufferedChunks=262144] The maximum number of | ||
| * buffered data chunks | ||
| * @param {Number} [options.maxFragments=131072] The maximum number of message | ||
| * @param {Number} [options.maxFragments=16384] The maximum number of message | ||
| * fragments | ||
@@ -73,4 +73,4 @@ * @param {Number} [options.maxPayload=104857600] The maximum allowed message | ||
| autoPong: true, | ||
| maxBufferedChunks: 1024 * 1024, | ||
| maxFragments: 128 * 1024, | ||
| maxBufferedChunks: 256 * 1024, | ||
| maxFragments: 16 * 1024, | ||
| maxPayload: 100 * 1024 * 1024, | ||
@@ -77,0 +77,0 @@ skipUTF8Validation: false, |
+4
-4
@@ -649,5 +649,5 @@ /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex|Readable$", "caughtErrors": "none" }] */ | ||
| * handshake request | ||
| * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of | ||
| * @param {Number} [options.maxBufferedChunks=262144] The maximum number of | ||
| * buffered data chunks | ||
| * @param {Number} [options.maxFragments=131072] The maximum number of message | ||
| * @param {Number} [options.maxFragments=16384] The maximum number of message | ||
| * fragments | ||
@@ -674,4 +674,4 @@ * @param {Number} [options.maxPayload=104857600] The maximum allowed message | ||
| protocolVersion: protocolVersions[1], | ||
| maxBufferedChunks: 1024 * 1024, | ||
| maxFragments: 128 * 1024, | ||
| maxBufferedChunks: 256 * 1024, | ||
| maxFragments: 16 * 1024, | ||
| maxPayload: 100 * 1024 * 1024, | ||
@@ -678,0 +678,0 @@ skipUTF8Validation: false, |
+5
-1
| { | ||
| "name": "ws", | ||
| "version": "8.21.0", | ||
| "version": "8.21.1", | ||
| "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", | ||
@@ -69,3 +69,7 @@ "keywords": [ | ||
| "utf-8-validate": "^6.0.0" | ||
| }, | ||
| "allowScripts": { | ||
| "bufferutil": true, | ||
| "utf-8-validate": true | ||
| } | ||
| } |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
150792
-0.2%4332
-0.35%