Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package powerdevil5 for openSUSE:Factory checked in at 2022-06-18 22:05:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/powerdevil5 (Old) and /work/SRC/openSUSE:Factory/.powerdevil5.new.1548 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "powerdevil5" Sat Jun 18 22:05:32 2022 rev:138 rq:983420 version:5.25.0 Changes: -------- --- /work/SRC/openSUSE:Factory/powerdevil5/powerdevil5.changes 2022-06-13 13:02:58.693154531 +0200 +++ /work/SRC/openSUSE:Factory/.powerdevil5.new.1548/powerdevil5.changes 2022-06-18 22:05:40.883612767 +0200 @@ -1,0 +2,7 @@ +Fri Jun 17 05:43:01 UTC 2022 - Bruno Pitrus <brunopit...@hotmail.com> + +- Add backported upower-Prevent-integer-overflow-during-new-brightness.patch + * Fixes brightness stuck on low level on systems with multiple GPUS + ( boo#1199907 kde#454161 ) + +------------------------------------------------------------------- New: ---- upower-Prevent-integer-overflow-during-new-brightness.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ powerdevil5.spec ++++++ --- /var/tmp/diff_new_pack.NyF55K/_old 2022-06-18 22:05:41.451613574 +0200 +++ /var/tmp/diff_new_pack.NyF55K/_new 2022-06-18 22:05:41.455613580 +0200 @@ -33,6 +33,8 @@ Source1: powerdevil-%{version}.tar.xz.sig Source2: plasma.keyring %endif +# PATCH-FIX-UPSTREAM https://invent.kde.org/plasma/powerdevil/-/commit/dd74cdbdd3849fbd86e6613ef7ecab6c7857cb89 +Patch0: upower-Prevent-integer-overflow-during-new-brightness.patch BuildRequires: extra-cmake-modules >= 1.2.0 BuildRequires: kf5-filesystem BuildRequires: systemd-rpm-macros ++++++ upower-Prevent-integer-overflow-during-new-brightness.patch ++++++ >From dd74cdbdd3849fbd86e6613ef7ecab6c7857cb89 Mon Sep 17 00:00:00 2001 From: ivan tkachenko <m...@ratijas.tk> Date: Thu, 16 Jun 2022 00:17:42 +0300 Subject: [PATCH] upower: Prevent integer overflow during new brightness computation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Provably, if two integers can fit in 31 bits each, the result of their multiplication is expressible in 62 bits (let alone 63 available). So, this should be safe. And the division can't do much harm: the divisor is always at least 1, and worst case scenario ??? it would be so big that the overall results becomes zero. This code still assumes that the allowed brightness values can fit in 32 bits int, which is not totally unreasonable so far. BUG: 454161 (cherry picked from commit 2ebe655d220c9167b66893a823b2fff2e2b8a531) --- daemon/backends/upower/backlighthelper.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/daemon/backends/upower/backlighthelper.cpp b/daemon/backends/upower/backlighthelper.cpp index 84c6aee1..c9e34e4b 100644 --- a/daemon/backends/upower/backlighthelper.cpp +++ b/daemon/backends/upower/backlighthelper.cpp @@ -27,6 +27,7 @@ #include <KLocalizedString> #include <algorithm> +#include <climits> #include <sys/utsname.h> #ifdef Q_OS_FREEBSD @@ -318,11 +319,13 @@ bool BacklightHelper::writeBrightness(int brightness) const #else if (!m_devices.isEmpty()) { - int first_maxbrightness = m_devices.constFirst().second; - if (first_maxbrightness <= 0) - first_maxbrightness = 1; + const int first_maxbrightness = std::max(1, m_devices.constFirst().second); for (const auto &device : m_devices) { - writeToDevice(device.first, brightness * device.second / first_maxbrightness); + // Some monitor brightness values are ridiculously high, and can easily overflow during computation + const qint64 new_brightness_64 = static_cast<qint64>(brightness) * static_cast<qint64>(device.second) / static_cast<qint64>(first_maxbrightness); + // cautiously truncate it back + const int new_brightness = static_cast<int>(std::min(static_cast<qint64>(std::numeric_limits<int>::max()), new_brightness_64)); + writeToDevice(device.first, new_brightness); } } -- GitLab