mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-12-05 09:55:11 +00:00
fix: bound peer-supplied wheel deltas and screenshot displays
Refs #17396. A wheel or trackpad event passed its delta straight to the input backend. X11, uinput and macOS post one event per unit while holding the input lock, so one event with a delta near i32::MAX kept the lock for hours, blocked input for every session and went on after the peer disconnected. Clamp it to the bound the relative-move path already uses; clients send deltas of a few units. A screenshot request is kept in a global map until its display is captured. A request naming a display that does not exist was never removed, so a peer could grow the map without limit. Ignore such requests; the client already gives up after its 30 s cooldown, which is what happened to them before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkig1bcC5Xrr1uwX47b
This commit is contained in:
1 parent
ae717917e2
commit
c70d42671a
2 files changed
+9
No files matched your search
@@ -4186,6 +4186,11 @@ impl Connection {
|
||||
// TODO: Maybe we can do a voice call from cm directly.
|
||||
}
|
||||
Some(message::Union::ScreenshotRequest(request)) => {
|
||||
// Requests are kept until their display is captured, so one that names no
|
||||
// display would stay in the global map for the life of the process.
|
||||
if request.display as usize >= Self::video_source_count(self.video_source()) {
|
||||
return true;
|
||||
}
|
||||
if let Some(tx) = self.inner.tx.clone() {
|
||||
crate::video_service::set_take_screenshot(
|
||||
self.video_source(),
|
||||
|
||||
@@ -1421,6 +1421,10 @@ pub fn handle_mouse_simulation_(evt: &MouseEvent, conn: i32) {
|
||||
{
|
||||
y = -y;
|
||||
}
|
||||
// X11, uinput and macOS post one event per unit while holding the input lock.
|
||||
const MAX_WHEEL_DELTA: i32 = 10000;
|
||||
x = x.clamp(-MAX_WHEEL_DELTA, MAX_WHEEL_DELTA);
|
||||
y = y.clamp(-MAX_WHEEL_DELTA, MAX_WHEEL_DELTA);
|
||||
|
||||
#[cfg(any(target_os = "macos", target_os = "windows"))]
|
||||
let is_track_pad = evt_type == MOUSE_TYPE_TRACKPAD;
|
||||
|
||||
Reference in new issue
Block a user