Cast more values to int to avoid crashes

Previously, click-dragging values in the matrix mixer would make
ffado-mixer crash.

Signed-off-by: Nils Philippsen <nils@tiptoe.de>
epel8
Nils Philippsen 3 years ago
parent 4fc0174098
commit 5153fbc39e

@ -0,0 +1,50 @@
From 9d4f2266ee06acc69f312cf2d67047ff74d60b95 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@tiptoe.de>
Date: Thu, 7 Apr 2022 17:09:57 +0200
Subject: [PATCH] Cast more values to int to avoid crashes
Signed-off-by: Nils Philippsen <nils@tiptoe.de>
---
.../support/mixer-qt4/ffado/widgets/matrixmixer.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/libffado/support/mixer-qt4/ffado/widgets/matrixmixer.py b/libffado/support/mixer-qt4/ffado/widgets/matrixmixer.py
index f63f6fc7..6da8bf40 100644
--- a/libffado/support/mixer-qt4/ffado/widgets/matrixmixer.py
+++ b/libffado/support/mixer-qt4/ffado/widgets/matrixmixer.py
@@ -210,7 +210,9 @@ class MixerNode(QAbstractSlider):
newpos = ev.posF() if ffado_pyqt_version == 4 else ev.localPos()
change = newpos.y() - self.pos.y()
#log.debug("MixerNode.mouseReleaseEvent() change %s" % (str(change)))
- self.setValue( self.tmpvalue - math.copysign(pow(abs(change), 2), change) )
+ self.setValue(
+ int(self.tmpvalue - math.copysign(pow(abs(change), 2), change))
+ )
ev.accept()
def mouseReleaseEvent(self, ev):
@@ -218,7 +220,9 @@ class MixerNode(QAbstractSlider):
newpos = ev.posF() if ffado_pyqt_version == 4 else ev.localPos()
change = newpos.y() - self.pos.y()
#log.debug("MixerNode.mouseReleaseEvent() change %s" % (str(change)))
- self.setValue( self.tmpvalue - math.copysign(pow(abs(change), 2), change) )
+ self.setValue(
+ int(self.tmpvalue - math.copysign(pow(abs(change), 2), change))
+ )
self.pos = QtCore.QPointF(0, 0)
del self.tmpvalue
ev.accept()
@@ -229,7 +233,9 @@ class MixerNode(QAbstractSlider):
if (ev.modifiers() & Qt.ControlModifier):
tmpvalue = self.value()
change = ev.delta()/8
- self.setValue( tmpvalue + math.copysign(pow(abs(change), 2), change) )
+ self.setValue(
+ int(self.tmpvalue - math.copysign(pow(abs(change), 2), change))
+ )
ev.accept()
else:
ev.ignore()
--
2.35.1

@ -7,7 +7,7 @@
Summary: Free firewire audio driver library
Name: libffado
Version: 2.4.5
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2 or GPLv3
URL: http://www.ffado.org/
Source0: http://www.ffado.org/files/%{name}-%{version}.tgz
@ -18,6 +18,7 @@ Source9: libffado-snapshot.sh
Patch0: libffado-2.4.4-no-test-apps.patch
Patch1: libffado-2.4.4-icon-name.patch
Patch2: libffado-2.4.4-scons-quirk.patch
Patch3: 0001-Cast-more-values-to-int-to-avoid-crashes.patch
BuildRequires: alsa-lib-devel
BuildRequires: dbus-c++-devel
@ -80,6 +81,7 @@ Applications and utilities for use with libffado.
%if %needs_scons_quirk
%patch2 -p1 -b .scons-quirk
%endif
%patch3 -p2 -b .cast-more-values
# Fix Python shebangs
sed -i 's|/usr/bin/.*python$|/usr/bin/python3|' \
@ -162,6 +164,9 @@ appstream-util validate-relax --nonet \
%changelog
* Thu Apr 07 2022 Nils Philippsen <nils@tiptoe.de> - 2.4.5-2
- Cast more float values to int to avoid crashes
* Sat Mar 12 2022 Nils Philippsen <nils@tiptoe.de> - 2.4.5-1
- Version 2.4.5

Loading…
Cancel
Save