diff --git a/core/rfb.js b/core/rfb.js index 8ac38aab..b4045e52 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -2491,6 +2491,8 @@ export default class RFB extends EventTargetMixin { this._FBU.width = this._sock.rQshift16(); this._FBU.height = this._sock.rQshift16(); this._FBU.encoding = this._sock.rQshift32(); + /* Encodings are signed */ + this._FBU.encoding >>= 0; } if (!this._handleRect()) { diff --git a/core/websock.js b/core/websock.js index 7cd87091..2b9b519a 100644 --- a/core/websock.js +++ b/core/websock.js @@ -121,7 +121,7 @@ export default class Websock { for (let byte = bytes - 1; byte >= 0; byte--) { res += this._rQ[this._rQi++] << (byte * 8); } - return res; + return res >>> 0; } rQshiftStr(len) {