Package: qjoypad
Version: 4.3.1-3.1
Severity: important
Tags: patch
Dear Maintainer,
qjoypad fails to build from source when built with -O3 and LTO
(-flto=auto -ffat-lto-objects) under GCC 15 (as on Ubuntu ppc64el):
In function 'sendevent',
inlined from 'move' at /usr/src/qjoypad-4.3.1-3.1/src/axis.cpp:436:11:
/usr/src/qjoypad-4.3.1-3.1/src/event.cpp:8:5: error: 'MEM <unsigned int>
[(struct FakeEvent *)&e]' may be used uninitialized
[-Werror=maybe-uninitialized]
In Axis::move() (src/axis.cpp), when mode != Keyboard and press == false,
FakeEvent e is never initialized, and sendevent() reads uninitialized memory
(e.type). With LTO and -O3, sendevent() is inlined and GCC's -Werror makes this
fatal.
The attached patch fixes this by returning early in Axis::move() when released
in mouse mode (as mouse movement has no release action) and value-initializing
FakeEvent e{}.
Ubuntu tracking bug:
https://bugs.launchpad.net/ubuntu/+source/qjoypad/+bug/2170324
Regards,
Viktor Pashaiev
Description: Fix uninitialized FakeEvent read in Axis::move()
When Axis::move() is called in mouse mode with press == false, FakeEvent e
is not initialized, causing sendevent() to read uninitialized memory (e.type).
Under -O3 and -flto=auto, GCC 15 inlines sendevent() into Axis::move(),
triggering a fatal -Werror=maybe-uninitialized error.
Fix by returning early when released in mouse mode (since there is no release
event for mouse motion) and value-initializing FakeEvent e.
Author: Viktor Pashaiev <[email protected]>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qjoypad/+bug/2170324
Last-Update: 2026-10-11
--- a/src/axis.cpp
+++ b/src/axis.cpp
@@ -352,7 +352,7 @@
}
void Axis::move( bool press ) {
- FakeEvent e;
+ FakeEvent e{};
if (mode == Keyboard) {
//prevent KeyPress-KeyPress and KeyRelease-KeyRelease pairs.
//this would only happen in odd circumstances involving the setup
@@ -432,6 +432,9 @@
e.move.x = -dist;
e.move.y = 0;
}
+ }
+ else {
+ return;
}
//actually create the event
sendevent(e);