aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason E. Hale <jhale@FreeBSD.org>2024-05-15 23:56:38 +0000
committerJason E. Hale <jhale@FreeBSD.org>2024-05-16 00:04:35 +0000
commit910c4d572da2fcc17dc9d646136dfb6d6e9fdcc4 (patch)
tree9cb6b933e6f45dcd7979b66ed1e9b96ef77fc239
parente8878d73df73094fa6fd3ca078b1f6b1bac6a55d (diff)
downloadports-910c4d572da2fcc17dc9d646136dfb6d6e9fdcc4.tar.gz
ports-910c4d572da2fcc17dc9d646136dfb6d6e9fdcc4.zip
audio/rsgain: Fix segmentation fault
When calculating album loudness on a drectory containing one or more audio files using `rsgain easy .`, for example, a segmentation fault can occur. Affects versions 3.4 and 3.5. PR: 278838 Reported by: <pere_goriot99@yahoo.com> MFH: 2024Q2 (cherry picked from commit 99bafb68144c1824441d3b47c3dc141c7721148b)
-rw-r--r--audio/rsgain/Makefile1
-rw-r--r--audio/rsgain/files/patch-src_scan.cpp16
2 files changed, 17 insertions, 0 deletions
diff --git a/audio/rsgain/Makefile b/audio/rsgain/Makefile
index 77f2e7f5f933..0c4d8bd4aa04 100644
--- a/audio/rsgain/Makefile
+++ b/audio/rsgain/Makefile
@@ -1,5 +1,6 @@
PORTNAME= rsgain
DISTVERSION= 3.5
+PORTREVISION= 1
DISTVERSIONSUFFIX= -source
CATEGORIES= audio
MASTER_SITES= https://github.com/complexlogic/rsgain/releases/download/v${DISTVERSION}/
diff --git a/audio/rsgain/files/patch-src_scan.cpp b/audio/rsgain/files/patch-src_scan.cpp
new file mode 100644
index 000000000000..3d9dbb23b23f
--- /dev/null
+++ b/audio/rsgain/files/patch-src_scan.cpp
@@ -0,0 +1,16 @@
+Fix a segfault when calculating album loudness.
+
+PR: 278838
+Regressed by: https://github.com/complexlogic/rsgain/commit/63e87a4f7d3b5c816eab630fba41ba9a63b82519
+
+--- src/scan.cpp.orig 2024-02-25 17:47:20 UTC
++++ src/scan.cpp
+@@ -639,7 +639,7 @@ void ScanJob::calculate_album_loudness()
+ std::vector<ebur128_state*> states(nb_states);
+ for (const Track &track : tracks)
+ if (track.result.track_loudness != -HUGE_VAL)
+- states.emplace_back(track.ebur128.get());
++ states[(size_t) (&track - &tracks[0])] = track.ebur128.get();
+
+ if (ebur128_loudness_global_multiple(states.data(), states.size(), &album_loudness) != EBUR128_SUCCESS)
+ album_loudness = config.target_loudness;