forge
Explore
Log in

Don't you dare go Hollow

virtual_pointer: Use saturating math for the v120 value

Browse files at this commit

5f2bbe7cb8bf6dbaf9e2f65d5c72dad6f1343645WitteShadovvParent: 2149706
discrete arrives from the client as an i32, so discrete * 120 overflows
past 17895697 and panics with overflow-checks on. The virtual pointer is
behind client_is_unrestricted, so this isn't reachable from a sandboxed
client, but it still shouldn't be able to abort the compositor.
src/protocols/virtual_pointer.rsmodified+3 -1
@@ -516,7 +516,9 @@ where
516 }516 }
517 };517 };
518 pointer.mutate_axis_frame(Some(time), |frame| {518 pointer.mutate_axis_frame(Some(time), |frame| {
519- frame.value(axis, value).v120(axis, discrete * 120)519+ frame
520+ .value(axis, value)
521+ .v120(axis, discrete.saturating_mul(120))
520 });522 });
521 }523 }
522 zwlr_virtual_pointer_v1::Request::Destroy => {}524 zwlr_virtual_pointer_v1::Request::Destroy => {}