From b35733edb6df2a00b6af9b1c98627d344c377963 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 22 Jan 2019 09:43:17 +0100 Subject: [PATCH] Fix expected mouse event sizes Commit fefb9816a99e6f8fa59befcfb70ba87112f90a8d modified mouse events serialization. The server-side parsing was updated to correctly read the position, but the expected size of these events was not updated. As a result, the server might try to parse incomplete events, leading to BufferUnderflowException. Fixes . --- .../main/java/com/genymobile/scrcpy/ControlEventReader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/ControlEventReader.java b/server/src/main/java/com/genymobile/scrcpy/ControlEventReader.java index e47ca309..28e9503a 100644 --- a/server/src/main/java/com/genymobile/scrcpy/ControlEventReader.java +++ b/server/src/main/java/com/genymobile/scrcpy/ControlEventReader.java @@ -9,8 +9,8 @@ import java.nio.charset.StandardCharsets; public class ControlEventReader { private static final int KEYCODE_PAYLOAD_LENGTH = 9; - private static final int MOUSE_PAYLOAD_LENGTH = 13; - private static final int SCROLL_PAYLOAD_LENGTH = 16; + private static final int MOUSE_PAYLOAD_LENGTH = 17; + private static final int SCROLL_PAYLOAD_LENGTH = 20; private static final int COMMAND_PAYLOAD_LENGTH = 1; public static final int TEXT_MAX_LENGTH = 300;