[packages/mp3gain] Up to 1.6.2
arekm
arekm at pld-linux.org
Sat Nov 28 17:47:04 CET 2026
commit c4cdbc031753f9aee6b485e94fde126a5aff4a78
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Fri Nov 27 16:15:37 2026 +0100
Up to 1.6.2
Fixes CVE-2023-49356, CVE-2021-34085, CVE-2019-18359,
CVE-2018-10778, CVE-2018-10777, CVE-2018-10776, CVE-2017-14412,
CVE-2017-14411, CVE-2017-14410, CVE-2017-14409, CVE-2017-14408,
CVE-2017-14407, CVE-2017-14406, CVE-2017-12912, CVE-2017-12911.
mp3gain-Makefile.patch | 4 +-
mp3gain-security.patch | 179 +++++++++++++++++++++++++++++++++++++++++++++++++
mp3gain.spec | 15 +++--
3 files changed, 190 insertions(+), 8 deletions(-)
---
diff --git a/mp3gain.spec b/mp3gain.spec
index 3622f0c..7047f1b 100644
--- a/mp3gain.spec
+++ b/mp3gain.spec
@@ -1,15 +1,17 @@
-%define subver _r2
Summary: Analyzes and losslessly adjusts MP3 files to a specified target volume
Summary(pl.UTF-8): Analiza i bezstratne dostrojenie plików MP3 do zadanej głośności
Name: mp3gain
-Version: 1.5.2
-Release: 2
+Version: 1.6.2
+Release: 1
License: LGPL
Group: Applications/Sound
-Source0: http://dl.sourceforge.net/mp3gain/%{name}-%(echo %{version} | tr . _)%{subver}-src.zip
-# Source0-md5: b8e429f3225cc298c5d13d31afd050b6
+Source0: https://downloads.sourceforge.net/mp3gain/%{name}-%(echo %{version} | tr . _)-src.zip
+# Source0-md5: 013551d985f517d9f0d767ee51366f1b
Patch0: %{name}-Makefile.patch
-URL: http://mp3gain.sourceforge.net/
+# CVE-2018-10777, CVE-2019-18359, CVE-2023-49356; from Debian/openSUSE
+Patch1: %{name}-security.patch
+URL: https://mp3gain.sourceforge.net/
+BuildRequires: libmpg123-devel
BuildRequires: unzip
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -28,6 +30,7 @@ tak naprawdę plik brzmi dla ludzkiego ucha.
%prep
%setup -q -c
%patch -P0 -p1
+%patch -P1 -p1
%build
%{__make} \
diff --git a/mp3gain-Makefile.patch b/mp3gain-Makefile.patch
index a9fc509..9294814 100644
--- a/mp3gain-Makefile.patch
+++ b/mp3gain-Makefile.patch
@@ -1,5 +1,5 @@
---- mp3gain-1.5.2/Makefile~ 2010-08-04 22:55:39.000000000 +0200
-+++ mp3gain-1.5.2/Makefile 2011-01-15 16:03:09.055103265 +0100
+--- mp3gain-1.6.2/Makefile~ 2010-08-04 22:55:39.000000000 +0200
++++ mp3gain-1.6.2/Makefile 2011-01-15 16:03:09.055103265 +0100
@@ -6,7 +6,7 @@
CC?= gcc
diff --git a/mp3gain-security.patch b/mp3gain-security.patch
new file mode 100644
index 0000000..d4d7159
--- /dev/null
+++ b/mp3gain-security.patch
@@ -0,0 +1,179 @@
+From: Jason Craig <os-dev at jacraig.com>
+Date: Mon, 30 Mar 2020 12:43:20 -0600
+References: boo#1154971
+Origin: https://build.opensuse.org/package/view_file/openSUSE:Maintenance:12304/mp3gain.openSUSE_Leap_15.1_Update/0001-fix-security-bugs.patch?rev=0db47562b2545871d0be3fc88083e0cd
+Bug-Debian: https://bugs.debian.org/973932
+Forwarded: https://sourceforge.net/p/mp3gain/bugs/62/
+Subject: [PATCH 1/4] Fix various security issues including CVE-2019-18359
+
+--- a/apetag.c
++++ b/apetag.c
+@@ -16,6 +16,13 @@
+ #define _stricmp strcasecmp
+ #endif /* WIN32 */
+
++// Min and max values for gain and peak in order to fit in allotted space in the APE tags. For gain that is nine chars,
++// including a + or -. For peak that is eight chars, including a - but no +. Both will always have six precision digits.
++#define MIN_GAIN -9.999999
++#define MAX_GAIN 9.999999
++#define MIN_PEAK -9.99999
++#define MAX_PEAK 9.999999
++
+ int ReadMP3ID3v1Tag(FILE *fi, unsigned char **tagbuff, long *tag_offset) {
+ char tmp[128];
+
+@@ -102,9 +109,9 @@
+ if ( fseek (fp, *tag_offset - 128 - (long)sizeof (T) - len, SEEK_SET) ) return 0;
+ if ( fread (tmp, 1, 11, fp) != 11 ) return 0;
+ if ( memcmp (tmp, "LYRICSBEGIN", 11) ) return 0;
+-
++
+ taglen = 128 + Lyrics3GetNumber6(T.Length) + sizeof(T);
+-
++
+ *tag_offset -= taglen;
+ if (*tagbuff != NULL) {
+ free(*tagbuff);
+@@ -142,7 +149,7 @@
+
+ unsigned long strlen_max(const char * ptr, unsigned long max) {
+ unsigned long n = 0;
+- while (ptr[n] && n < max) n++;
++ while (n < max && ptr[n]) n++;
+ return n;
+ }
+
+@@ -234,6 +241,14 @@
+ info->albumPeak = atof(value);
+ } else if (!_stricmp(name,"MP3GAIN_UNDO")) {
+ /* value should be something like "+003,+003,W" */
++ /* If the file didn't specify enough bytes for the value (at least 11...see above), skip the tag. */
++ if(vsize < 11)
++ {
++ free(value);
++ free(name);
++ p += isize + 1 + vsize;
++ continue;
++ }
+ info->haveUndo = !0;
+ vp = value;
+ memcpy(tmpString,vp,4);
+@@ -251,6 +266,14 @@
+ }
+ } else if (!_stricmp(name,"MP3GAIN_MINMAX")) {
+ /* value should be something like "001,153" */
++ /* If the file didn't specify enough bytes for the value (at least 7...see above), skip the tag. */
++ if(vsize < 7)
++ {
++ free(value);
++ free(name);
++ p += isize + 1 + vsize;
++ continue;
++ }
+ info->haveMinMaxGain = !0;
+ vp = value;
+ memcpy(tmpString,vp,3);
+@@ -289,7 +312,7 @@
+ }
+
+ free (buff);
+-
++
+ *tag_offset -= TagLen;
+ (*apeTag)->originalTagSize = TagLen;
+
+@@ -318,7 +341,7 @@
+ int truncate_file (char *filename, long truncLength) {
+
+ #ifdef WIN32
+-
++
+ int fh, result;
+
+ /* Open a file */
+@@ -370,10 +393,10 @@
+ fi = fopen(filename, "rb");
+ if (fi == NULL)
+ return 0;
+-
++
+ fseek(fi, 0, SEEK_END);
+ tag_offset = file_size = ftell(fi);
+-
++
+ fileTags->lyrics3TagSize = 0;
+
+ do {
+@@ -515,7 +538,7 @@
+ Write_LE_Uint32(newFooter.Flags,1<<31); /* tag has header */
+ memset(newFooter.Reserved,0,sizeof(newFooter.Reserved));
+ }
+-
++
+ if (info->haveMinMaxGain) {
+ /* 8 bytes + "MP3GAIN_MINMAX" + '/0' + "123,123" = 30 bytes */
+ Write_LE_Uint32(mp3gainTagData,7);
+@@ -575,7 +598,10 @@
+ mp3gainTagData += 4;
+ strcpy(mp3gainTagData, "REPLAYGAIN_TRACK_GAIN");
+ mp3gainTagData += 22;
+- sprintf(valueString,"%-+9.6f", info->trackGain);
++ // Clamp the gain value to ensure that sprintf won't put more than 9 chars in valueString. In cases of very
++ // large trackGain value, valueString could overflow.
++ sprintf(valueString, "%-+9.6f", info->trackGain < MIN_GAIN ? MIN_GAIN
++ : (info->trackGain > MAX_GAIN ? MAX_GAIN : info->trackGain));
+ memcpy(mp3gainTagData, valueString, 9);
+ mp3gainTagData += 9;
+ memcpy(mp3gainTagData, " dB", 3);
+@@ -589,7 +615,10 @@
+ mp3gainTagData += 4;
+ strcpy(mp3gainTagData, "REPLAYGAIN_TRACK_PEAK");
+ mp3gainTagData += 22;
+- sprintf(valueString,"%-8.6f", info->trackPeak);
++ // Clamp the peak value to ensure that sprintf won't put more than 8 chars in valueString. In cases of very
++ // large trackPeak value, valueString could overflow.
++ sprintf(valueString,"%-8.6f", info->trackPeak < MIN_PEAK ? MIN_PEAK
++ : (info->trackPeak > MAX_PEAK ? MAX_PEAK : info->trackPeak));
+ memcpy(mp3gainTagData, valueString, 8);
+ mp3gainTagData += 8;
+ }
+@@ -601,7 +630,9 @@
+ mp3gainTagData += 4;
+ strcpy(mp3gainTagData, "REPLAYGAIN_ALBUM_GAIN");
+ mp3gainTagData += 22;
+- sprintf(valueString,"%-+9.6f", info->albumGain);
++ // Clamp the gain value, see haveTrackGain if above.
++ sprintf(valueString,"%-+9.6f", info->albumGain < MIN_GAIN ? MIN_GAIN
++ : (info->albumGain > MAX_GAIN ? MAX_GAIN : info->albumGain));
+ memcpy(mp3gainTagData, valueString, 9);
+ mp3gainTagData += 9;
+ memcpy(mp3gainTagData, " dB", 3);
+@@ -615,7 +646,9 @@
+ mp3gainTagData += 4;
+ strcpy(mp3gainTagData, "REPLAYGAIN_ALBUM_PEAK");
+ mp3gainTagData += 22;
+- sprintf(valueString,"%-8.6f", info->albumPeak);
++ // Clamp the peak value, see haveTrackPeak if above.
++ sprintf(valueString,"%-8.6f", info->albumPeak < MIN_PEAK ? MIN_PEAK
++ : (info->albumPeak > MAX_PEAK ? MAX_PEAK : info->albumPeak));
+ memcpy(mp3gainTagData, valueString, 8);
+ mp3gainTagData += 8;
+ }
+@@ -641,7 +674,7 @@
+ } //no Lyrics3 tag
+
+ fclose(outputFile);
+-
++
+ if (saveTimeStamp)
+ fileTime(filename,setStoredTime);
+
+@@ -666,7 +699,7 @@
+ info.haveMinMaxGain = 0;
+ info.haveAlbumMinMaxGain = 0;
+ info.haveUndo = 0;
+-
++
+ fileTags.apeTag = NULL;
+ fileTags.id31tag = NULL;
+ fileTags.lyrics3tag = NULL;
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/mp3gain.git/commitdiff/c4cdbc031753f9aee6b485e94fde126a5aff4a78
More information about the pld-cvs-commit
mailing list