mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-06-26 04:31:23 +02:00
Move error handling to Inflate class
Every call wants this check so this should be done inside the class.
This commit is contained in:
parent
5e4544d5fc
commit
b690ae4c2d
@ -175,9 +175,6 @@ export default class TightDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = this._zlibs[streamId].inflate(data, uncompressedSize);
|
data = this._zlibs[streamId].inflate(data, uncompressedSize);
|
||||||
if (data.length != uncompressedSize) {
|
|
||||||
throw new Error("Incomplete zlib block");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
display.blitRgbImage(x, y, width, height, data, 0, false);
|
display.blitRgbImage(x, y, width, height, data, 0, false);
|
||||||
@ -223,9 +220,6 @@ export default class TightDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = this._zlibs[streamId].inflate(data, uncompressedSize);
|
data = this._zlibs[streamId].inflate(data, uncompressedSize);
|
||||||
if (data.length != uncompressedSize) {
|
|
||||||
throw new Error("Incomplete zlib block");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert indexed (palette based) image data to RGB
|
// Convert indexed (palette based) image data to RGB
|
||||||
|
@ -37,6 +37,10 @@ export default class Inflate {
|
|||||||
|
|
||||||
inflate(this.strm, 0); // Flush argument not used.
|
inflate(this.strm, 0); // Flush argument not used.
|
||||||
|
|
||||||
|
if (this.strm.next_out != expected) {
|
||||||
|
throw new Error("Incomplete zlib block");
|
||||||
|
}
|
||||||
|
|
||||||
return new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
|
return new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user