Skip to content

Fix for issue #2210: app: Do not set redundant members in GimpDeviceInfo.

I have an usb mouse with extra functionality (more buttons, dpi resolution adjustments)

Udev creates several entries for the same device in /dev/input

/dev/input/event7:	SteelSeries Sensei Raw Gaming Mouse
/dev/input/event8:	SteelSeries Sensei Raw Gaming Mouse
/dev/input/event9:	SteelSeries Sensei Raw Gaming Mouse

I do not know if this is due to my system not being properly configured, but I suspect that's not the case.

Testing each one of these with evtest reveals they generate different kind of event codes. It's not the same event repeated, nor any of them refer to a dead device.

The crash was due to GIMP iterating over these devices, calling gimp_device_info_set_device each time and overwriting the info values with the ones from the current device.

On the third call info->axes happened to be a NULL pointer that the function then tries to access at line 562, crashing the program.

I've just added a check for NULL pointers around the function call. Problem fixed.

As an extra precaution I've done the same for the gimp_device_info_set_key as I know there are mouses that implement a keyboard interface (not my case though)

There's this comment (line 521 @ gimpdeviceinfo.c):

/*  don't bail out here, instead, simply continue and overwrite
 *  the info's old device with the new one.
 *
 *  NOTE that this only happens if something is wrong on the USB
 *  or udev or libinput or whatever side and the same device is
 *  present multiple times. The only "safe" thing is to assume
 *  that devices listed earlier are dead and dangling entities
 *  and that the last registered device is the one actually
 *  delivering events.
 */

Again, I cannot be 100% sure that the mouse getting assigned 3 separated events is normal, but the check is harmless.

I'm not sure why this started happening today. It's not a new mouse.

Edited by Sergio Jiménez Herena

Merge request reports