From 3268566c205ea9021c52c22c57d4cdc1b0637b1a Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 3 May 2020 11:36:55 +0200 Subject: [PATCH] Input: fix infinite loop Right shift on a signed value can extend the sign bit, which would make this function do an infinite loop if passed a negative value. Use an unsigned instead to get the behavior we want. Fixes #15957, but this means we're using undefined data from the settings file. I assumed it would have the unused button values set to 0 but this isn't apparently the case. Preetpal is already working on that as we noticed the problem when testing her patch for adding a 6th button. Change-Id: I62fdc778ff3b9da92f3aa5570163dc60baf8cf2c Reviewed-on: https://review.haiku-os.org/c/haiku/+/2560 Reviewed-by: waddlesplash --- src/preferences/input/MouseView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/preferences/input/MouseView.cpp b/src/preferences/input/MouseView.cpp index 38a53a29d5..29c319a3da 100644 --- a/src/preferences/input/MouseView.cpp +++ b/src/preferences/input/MouseView.cpp @@ -64,7 +64,7 @@ getButtonOffsets(int32 type) static uint32 -getMappingNumber(int32 mapping) +getMappingNumber(uint32 mapping) { if (mapping == 0) return 0;