Skip to content

Commit 33d0fbf

Browse files
committed
Fixed unexpected errors when compressing/decompressing data via WebSocket.
1 parent 6c28f5e commit 33d0fbf

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- fixed handling of unexpected problems in the Flow with the main process becoming disconnected
1010
- fixed `uptime` value in the framework stats
1111
- improved auditlogs by adding `files`
12+
- fixed unexpected errors when compressing/decompressing data via WebSocket
1213

1314
========================
1415
0.0.15

websocket.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,14 @@ Controller.prototype.parseinflate = function() {
488488
ctrl.inflatechunks = [];
489489
ctrl.inflatechunkslength = 0;
490490
ctrl.inflatelock = true;
491-
ctrl.inflate.write(buf);
491+
492+
try {
493+
ctrl.inflate.write(buf);
494+
} catch (e) {
495+
// invalid block
496+
self.onerror(e);
497+
return;
498+
}
492499

493500
if (!buf.$continue)
494501
ctrl.inflate.write(Buffer.from(SOCKET_COMPRESS));
@@ -575,7 +582,15 @@ Controller.prototype.senddeflate = function() {
575582
ctrl.deflatechunks = [];
576583
ctrl.deflatechunkslength = 0;
577584
ctrl.deflatelock = true;
578-
ctrl.deflate.write(buf);
585+
586+
try {
587+
ctrl.deflate.write(buf);
588+
} catch (e) {
589+
// invalid block
590+
self.onerror(e);
591+
return;
592+
}
593+
579594
ctrl.deflate.flush(function() {
580595
if (ctrl.deflatechunks) {
581596
var data = concat(ctrl.deflatechunks, ctrl.deflatechunkslength);

0 commit comments

Comments
 (0)