Re: SDL_EVDEV_do_text_input() may be too eager to find errors
"SirCodesAlot" <[email protected]> Thu, 05 Jan 2017 23:11:05 +0000
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <[email protected]> |
After reducing my hacky patch to the minimum number of changes needed to to fix my setup, I uncovered another bug in SDL_EVDEV_is_console() that I accidentally fixed. https://bugzilla.libsdl.org/show_bug.cgi?id=3546 When calling ioctl(fd, KDGKBTYPE, &type) in SDL_EVDEV_is_console(), we declare type as an 'int'. This should be a 'char'. The subsequent syscall, and kernel code, only writes the lower byte of the word. See: http://lxr.free-electrons.com/source/drivers/tty/vt/vt_ioctl.c?v=4.4#L399 ucval = KB_101; ret = put_user(ucval, (char __user *)arg); I've observed intermittent behavior related to this, and I can force an error condition by using an int initialized to 0xFFFFFFFF. The resulting ioctl will set type to 0XFFFFFF02, and the conditional return in SDL_EVDEV_is_console() will fail. Recommend changing to char, or masking off unused bits. See attached patch for suggested fix. -Rob _______________________________________________ SDL mailing list [email protected] http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org