Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wcmUSB: fix undefined behavior for bit-shifting
Automated test runs have detected the following issue while running UBSan checks: ~~~ ../src/wcmUSB.c:1372:11: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' #0 0x7f0444bcbd8c in mod_buttons ../src/wcmUSB.c:1372 #1 0x7f0444bd7f26 in test_mod_buttons ../src/wcmUSB.c:2090 #2 0x7f0444bfcea7 in wcm_run_tests ../test/wacom-test-suite.c:46 #3 0x56204d77b405 in main ../test/wacom-tests.c:44 #4 0x7f0448625082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) #5 0x56204d77b1cd in _start (/home/runner/work/xf86-input-wacom/xf86-input-wacom/builddir/wacom-tests+0x11cd) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/wcmUSB.c:1372:11 in The default type of a literal `1` is `int` and thus a leftshift of 31 is not permitted. Switch it to `1u` and thus `unsigned int` for Button 31 which is the max button we support (if zero-indexed). Link: https://github.com/linuxwacom/xf86-input-wacom/actions/runs/7049012015/job/19186502078 Signed-off-by: Peter Hutterer <[email protected]>
- Loading branch information