Mercurial > hg > Applications > TreeVNC
changeset 543:00841c822145
fix OutofBounds
author | riono |
---|---|
date | Thu, 14 Nov 2019 17:45:13 +0900 |
parents | 6051d8fb1f36 |
children | 0a6db7da38e8 |
files | src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java |
diffstat | 2 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Thu Nov 14 16:48:14 2019 +0900 +++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java Thu Nov 14 17:45:13 2019 +0900 @@ -203,9 +203,10 @@ if (c1rect.x == rect.x) { // phase0 needs no phase1 // make header space for phase2 c1.limit(c1.limit() + headerLength); + int pos = c1.position() - 1; // to make rectangle header shift last bytes - for (int i = 0; i < c1.position() - prevC1LineOffset; i++) { - c1.array()[prevC1LineOffset + headerLength - i] = c1.array()[prevC1LineOffset - i]; + for (int i = 0; i < pos - prevC1LineOffset; i++) { + c1.array()[pos + headerLength - i] = c1.array()[pos - i]; } prevC1Offset = prevC1LineOffset; }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Thu Nov 14 16:48:14 2019 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Thu Nov 14 17:45:13 2019 +0900 @@ -958,7 +958,7 @@ public void messageDump(Reader reader, String msg) { System.out.print(msg); try { - for (int i = 0; i < 100; i++) { // 20 + 4 + for (int i = 0; i < 24; i++) { // 20 + 4 System.out.print(Integer.toHexString(reader.readByte()) + " "); } } catch (TransportException e) {