summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2012-08-15 12:45:53 -0500
committerJoel Martin <github@martintribe.org>2012-08-15 12:45:53 -0500
commit14717eb468d9cf1c93559c8d0a6cb16b3c959b55 (patch)
treeb0aa63361210d6c29db846f34aa25d6695693b49
parent4dd1bb1ecbd49c112c2f7ff4bd66016ebe38d063 (diff)
downloadnovnc-14717eb468d9cf1c93559c8d0a6cb16b3c959b55.tar.gz
Fix tight decoding when using binary/non-base64 connection.
-rw-r--r--include/rfb.js6
-rw-r--r--include/util.js4
2 files changed, 7 insertions, 3 deletions
diff --git a/include/rfb.js b/include/rfb.js
index 00fb7d8..2a321d2 100644
--- a/include/rfb.js
+++ b/include/rfb.js
@@ -1252,11 +1252,11 @@ encHandlers.HEXTILE = function display_hextile() {
rQi += FBU.bytes - 1;
} else {
if (FBU.subencoding & 0x02) { // Background
- FBU.background = rQ.slice(rQi, rQi + fb_Bpp);
+ FBU.background = rQ.subarray(rQi, rQi + fb_Bpp);
rQi += fb_Bpp;
}
if (FBU.subencoding & 0x04) { // Foreground
- FBU.foreground = rQ.slice(rQi, rQi + fb_Bpp);
+ FBU.foreground = rQ.subarray(rQi, rQi + fb_Bpp);
rQi += fb_Bpp;
}
@@ -1266,7 +1266,7 @@ encHandlers.HEXTILE = function display_hextile() {
rQi += 1;
for (s = 0; s < subrects; s += 1) {
if (FBU.subencoding & 0x10) { // SubrectsColoured
- color = rQ.slice(rQi, rQi + fb_Bpp);
+ color = rQ.subarray(rQi, rQi + fb_Bpp);
rQi += fb_Bpp;
} else {
color = FBU.foreground;
diff --git a/include/util.js b/include/util.js
index 57ccb54..030afb4 100644
--- a/include/util.js
+++ b/include/util.js
@@ -18,6 +18,10 @@ var Util = {};
* Make arrays quack
*/
+Array.prototype.subarray = function (start, end) {
+ this.slice(start, end);
+};
+
Array.prototype.push8 = function (num) {
this.push(num & 0xFF);
};