summaryrefslogtreecommitdiff
path: root/games-strategy/s25rttr/files/s25rttr-0.9.1-libsamplerate.patch
diff options
context:
space:
mode:
Diffstat (limited to 'games-strategy/s25rttr/files/s25rttr-0.9.1-libsamplerate.patch')
-rw-r--r--games-strategy/s25rttr/files/s25rttr-0.9.1-libsamplerate.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/games-strategy/s25rttr/files/s25rttr-0.9.1-libsamplerate.patch b/games-strategy/s25rttr/files/s25rttr-0.9.1-libsamplerate.patch
new file mode 100644
index 000000000000..41d6d90e5fd8
--- /dev/null
+++ b/games-strategy/s25rttr/files/s25rttr-0.9.1-libsamplerate.patch
@@ -0,0 +1,37 @@
+From 16cb06c99f78a21b1be2bc681c1f1d85a6caddca Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Fri, 10 Sep 2021 22:59:51 +0100
+Subject: [PATCH] Fix bad channel count handling with libsamplerate 0.2.0
+
+Since libsndfile/libsamplerate@26d92c369394bcd0b0cea488890edce1a0d757d5,
+initialising libsamplerate with 0 channels or less causes a SIGABRT. We
+therefore need to handle this in the C++ wrapper classes.
+---
+ libs/libsamplerate/include/samplerate.hpp | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libs/libsamplerate/include/samplerate.hpp b/libs/libsamplerate/include/samplerate.hpp
+index d0af34317..23e243d91 100644
+--- a/libs/libsamplerate/include/samplerate.hpp
++++ b/libs/libsamplerate/include/samplerate.hpp
+@@ -152,6 +152,8 @@ class State : public detail::StateBase
+ {
+ static SRC_STATE* createOrThrow(Converter converter, int channels)
+ {
++ if (channels <= 0)
++ throw std::runtime_error("Channel count must be >= 1.");
+ int error;
+ auto* state = src_new(static_cast<int>(converter), channels, &error);
+ if(!state)
+@@ -174,6 +176,8 @@ class StateCallback : public detail::StateBase
+ {
+ static SRC_STATE* createOrThrow(Converter converter, int channels, src_callback_t func, void* data)
+ {
++ if (channels <= 0)
++ throw std::runtime_error("Channel count must be >= 1.");
+ int error;
+ auto* state = src_callback_new(func, static_cast<int>(converter), channels, &error, data);
+ if(!state)
+--
+2.32.0
+