Skip to content

Commit

Permalink
#8 fix lz4 + AES: check the correct packet size
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Aug 3, 2021
1 parent 09ccf59 commit cdc09f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1138,15 +1138,13 @@ XpraClient.prototype._make_hello_base = function() {
"connection-data" : ci,
});
}
if (!this.encryption) {
const LZ4 = require('lz4');
if(LZ4) {
this._update_capabilities({
"lz4" : true,
"lz4.js.version" : LZ4.version,
"encoding.rgb_lz4" : true,
});
}
const LZ4 = require('lz4');
if(LZ4) {
this._update_capabilities({
"lz4" : true,
"lz4.js.version" : LZ4.version,
"encoding.rgb_lz4" : true,
});
}

if(typeof BrotliDecode != "undefined" && !Utilities.isIE()) {
Expand Down
2 changes: 1 addition & 1 deletion html5/js/Protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ XpraProtocol.prototype.do_process_receive_queue = function() {
inflated = new Uint8Array(length);
const uncompressedSize = LZ4.decodeBlock(packet_data, inflated, 4);
// if lz4 errors out at the end of the buffer, ignore it:
if (uncompressedSize<=0 && packet_size+uncompressedSize!=0) {
if (uncompressedSize<=0 && packet_data.length+uncompressedSize!=0) {
this.protocol_error("failed to decompress lz4 data, error code: "+uncompressedSize);
return false;
}
Expand Down

0 comments on commit cdc09f3

Please sign in to comment.