public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: media-libs/libmp4v2/, media-libs/libmp4v2/files/
@ 2018-10-03 21:11 Andreas Sturmlechner
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Sturmlechner @ 2018-10-03 21:11 UTC (permalink / raw
  To: gentoo-commits

commit:     7419acce365a5445b1d05b11699ac97761569804
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  3 20:15:57 2018 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Oct  3 21:11:27 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7419acce

media-libs/libmp4v2: EAPI-7 bump, fix tag corruption

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
Package-Manager: Portage-2.3.50, Repoman-2.3.11

 .../{gcc7.patch => libmp4v2-2.0.0-gcc7.patch}      | 11 ++++++++---
 .../files/libmp4v2-2.0.0-mp4tags-corruption.patch  | 20 ++++++++++++++++++++
 ...mp4v2-2.0.0.ebuild => libmp4v2-2.0.0-r1.ebuild} | 22 +++++++++++++---------
 media-libs/libmp4v2/libmp4v2-2.0.0.ebuild          |  4 ++--
 4 files changed, 43 insertions(+), 14 deletions(-)

diff --git a/media-libs/libmp4v2/files/gcc7.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-gcc7.patch
similarity index 64%
rename from media-libs/libmp4v2/files/gcc7.patch
rename to media-libs/libmp4v2/files/libmp4v2-2.0.0-gcc7.patch
index fbfae97e58c..156f0fcbaa0 100644
--- a/media-libs/libmp4v2/files/gcc7.patch
+++ b/media-libs/libmp4v2/files/libmp4v2-2.0.0-gcc7.patch
@@ -1,8 +1,13 @@
 https://bugs.gentoo.org/show_bug.cgi?id=600892
 
---- mp4v2-2.0.0/src/rtphint.cpp	2012-05-20 16:11:53.000000000 -0600
-+++ /tmp/rtphint.cpp	2017-05-16 10:25:26.930705191 -0600
-@@ -339,7 +339,7 @@
+Description: Fix pointer comparison (FTBFS on GCC 7)
+Author: Philip Chung <philipchung1995@yahoo.com>
+Bug-Debian: https://bugs.debian.org/853560
+Last-Update: 2017-09-04
+
+--- a/src/rtphint.cpp
++++ b/src/rtphint.cpp
+@@ -339,7 +339,7 @@ void MP4RtpHintTrack::GetPayload(
                  pSlash = strchr(pSlash, '/');
                  if (pSlash != NULL) {
                      pSlash++;

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-mp4tags-corruption.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-mp4tags-corruption.patch
new file mode 100644
index 00000000000..1c41a41da98
--- /dev/null
+++ b/media-libs/libmp4v2/files/libmp4v2-2.0.0-mp4tags-corruption.patch
@@ -0,0 +1,20 @@
+From: "Matteo F. Vescovi" <mfv@debian.org>
+Date: Thu, 5 Nov 2015 15:26:00 +0100
+Subject: Fix_mp4tags_corruption
+
+---
+ util/mp4tags.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/util/mp4tags.cpp b/util/mp4tags.cpp
+index 1b9e866..80e89d4 100644
+--- a/util/mp4tags.cpp
++++ b/util/mp4tags.cpp
+@@ -539,6 +539,7 @@ extern "C" int
+                         else {
+                             fprintf( stderr, "Art file %s not found\n", tags[i] );
+                         }
++                        break;
+                     }
+                     case OPT_ALBUM_ARTIST:
+                         MP4TagsSetAlbumArtist( mdata, tags[i] );
\ No newline at end of file

diff --git a/media-libs/libmp4v2/libmp4v2-2.0.0.ebuild b/media-libs/libmp4v2/libmp4v2-2.0.0-r1.ebuild
similarity index 53%
copy from media-libs/libmp4v2/libmp4v2-2.0.0.ebuild
copy to media-libs/libmp4v2/libmp4v2-2.0.0-r1.ebuild
index b52cf1e5e63..9f5cac1bf14 100644
--- a/media-libs/libmp4v2/libmp4v2-2.0.0.ebuild
+++ b/media-libs/libmp4v2/libmp4v2-2.0.0-r1.ebuild
@@ -1,10 +1,10 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=4
-inherit libtool eutils
+EAPI=7
 
 MY_P=${P/lib}
+inherit libtool
 
 DESCRIPTION="Functions for accessing ISO-IEC:14496-1:2001 MPEG-4 standard"
 HOMEPAGE="https://code.google.com/p/mp4v2/"
@@ -12,20 +12,24 @@ SRC_URI="https://mp4v2.googlecode.com/files/${MY_P}.tar.bz2"
 
 LICENSE="MPL-1.1"
 SLOT="0"
-KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
 IUSE="static-libs test utils"
 
-RDEPEND=""
-DEPEND="sys-apps/sed
+BDEPEND="sys-apps/sed
 	utils? ( sys-apps/help2man )
 	test? ( dev-util/dejagnu )"
 
-DOCS="doc/*.txt README"
+DOCS=( doc/{Authors,BuildSource,Documentation,ReleaseNotes,ToolGuide}.txt README )
 
 S=${WORKDIR}/${MY_P}
 
+PATCHES=(
+	"${FILESDIR}/${P}-gcc7.patch"
+	"${FILESDIR}/${P}-mp4tags-corruption.patch"
+)
+
 src_prepare() {
-	epatch "${FILESDIR}/gcc7.patch"
+	default
 	elibtoolize
 }
 
@@ -38,5 +42,5 @@ src_configure() {
 
 src_install() {
 	default
-	find "${ED}" -name '*.la' -exec rm -f {} +
+	find "${D}" -name '*.la' -delete || die
 }

diff --git a/media-libs/libmp4v2/libmp4v2-2.0.0.ebuild b/media-libs/libmp4v2/libmp4v2-2.0.0.ebuild
index b52cf1e5e63..cd9550fdec8 100644
--- a/media-libs/libmp4v2/libmp4v2-2.0.0.ebuild
+++ b/media-libs/libmp4v2/libmp4v2-2.0.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=4
@@ -25,7 +25,7 @@ DOCS="doc/*.txt README"
 S=${WORKDIR}/${MY_P}
 
 src_prepare() {
-	epatch "${FILESDIR}/gcc7.patch"
+	epatch "${FILESDIR}/${P}-gcc7.patch"
 	elibtoolize
 }
 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/libmp4v2/, media-libs/libmp4v2/files/
@ 2020-08-03  0:49 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2020-08-03  0:49 UTC (permalink / raw
  To: gentoo-commits

commit:     1560154cd7f50715577cc36e52f8d03a15a80419
Author:     John Helmert III <jchelmert3 <AT> posteo <DOT> net>
AuthorDate: Mon Aug  3 00:49:30 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug  3 00:49:30 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1560154c

media-libs/libmp4v2: add security patches

Bug: https://bugs.gentoo.org/661582
Package-Manager: Portage-3.0.0, Repoman-2.3.23
Signed-off-by: John Helmert III <jchelmert3 <AT> posteo.net>
Closes: https://github.com/gentoo/gentoo/pull/16811
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/libmp4v2-2.0.0-CVE-2018-14054.patch      | 35 +++++++++++++
 .../files/libmp4v2-2.0.0-CVE-2018-14325.patch      | 60 ++++++++++++++++++++++
 .../files/libmp4v2-2.0.0-CVE-2018-14379.patch      | 33 ++++++++++++
 .../files/libmp4v2-2.0.0-CVE-2018-14403.patch      | 28 ++++++++++
 media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild       | 54 +++++++++++++++++++
 5 files changed, 210 insertions(+)

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14054.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14054.patch
new file mode 100644
index 00000000000..3ff3e731b93
--- /dev/null
+++ b/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14054.patch
@@ -0,0 +1,35 @@
+Upstream: https://github.com/sergiomb2/libmp4v2/commit/3410bc66fb91f46325ab1d008b6a421dd8240949
+Gentoo Bug: https://bugs.gentoo.org/661582
+
+From 3410bc66fb91f46325ab1d008b6a421dd8240949 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
+Date: Sat, 2 Nov 2019 04:21:17 +0000
+Subject: [PATCH] Null out pointer after free to prevent double free
+
+If an exception occurs (because of a crafted MP4) before the value is reassigned, then a double free can occur.  By setting the pointer to NULL after the first free, we prevent the double free in this case.
+Addresses: https://nvd.nist.gov/vuln/detail/CVE-2018-14054
+
+copied form https://github.com/TechSmith/mp4v2/commit/f09cceeee5bd7f783fd31f10e8b3c440ccf4c743
+From: Dave O'Rourke
+Date: Wed, 20 Mar 2019 08:57:29 -0400
+---
+ src/mp4property.cpp | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/mp4property.cpp b/src/mp4property.cpp
+index 9a5b1e3..1b8e1d2 100644
+--- a/src/mp4property.cpp
++++ b/src/mp4property.cpp
+@@ -391,8 +391,10 @@ void MP4StringProperty::Read( MP4File& file, uint32_t index )
+         char*& value = m_values[i];
+ 
+         // Generally a default atom setting, e.g. see atom_avc1.cpp, "JVT/AVC Coding"; we'll leak this string if
+-        // we don't free.  Note that MP4Free checks for null.
+-        MP4Free(value); 
++        // we don't free.  Note that this code checks for null before calling free and sets the pointer to null
++        // after freeing it, to prevent a double free in case an exception occurs before the value is reassigned.
++        MP4Free( value );
++        value = NULL;
+ 
+         if( m_useCountedFormat ) {
+             value = file.ReadCountedString( (m_useUnicode ? 2 : 1), m_useExpandedCount, m_fixedLength );

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14325.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14325.patch
new file mode 100644
index 00000000000..eb23926bb49
--- /dev/null
+++ b/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14325.patch
@@ -0,0 +1,60 @@
+Upstream: https://github.com/sergiomb2/libmp4v2/commit/9084868fd9f86bee118001c23171e832f15009f4
+Gentoo Bug: https://bugs.gentoo.org/661582
+
+
+From 9084868fd9f86bee118001c23171e832f15009f4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
+Date: Fri, 8 Nov 2019 02:01:32 +0000
+Subject: [PATCH] Fix v3 Integer underflow/overflow in MP4v2 2.0.0
+
+Reference: https://www.openwall.com/lists/oss-security/2018/07/16/1
+
+For the overflow, we could check the result of the integer multiplication:
+
+fix vulnerability where an atom list size is enormous
+and calculating the number of bytes needed to hold the list overflows
+https://github.com/TechSmith/mp4v2/pull/27/commits/70d823ccd8e2d7d0ed9e62fb7e8983d21e6acbeb
+
+Addresses https://nvd.nist.gov/vuln/detail/CVE-2018-14326 and https://nvd.nist.gov/vuln/detail/CVE-2018-14446
+
+For the underflow, we could check if `dataSize >= hdrSize` satisfies:
+Throw exception when invalid atom size would cause integer underflow
+The calculation `hdrSize - dataSize` can underflow the 64-bit unsigned int dataSize type, which can lead to incorrect results.  We throw an exception to stop the code from going any further.
+
+Addresses https://nvd.nist.gov/vuln/detail/CVE-2018-14325
+Based on https://github.com/TechSmith/mp4v2/commit/e475013c6ef78093055a02b0d035eda0f9f01451
+---
+ src/mp4array.h  | 2 ++
+ src/mp4atom.cpp | 6 ++++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/src/mp4array.h b/src/mp4array.h
+index c49d59b..69d470a 100644
+--- a/src/mp4array.h
++++ b/src/mp4array.h
+@@ -102,6 +102,8 @@ class MP4Array {
+         void Resize(MP4ArrayIndex newSize) { \
+             m_numElements = newSize; \
+             m_maxNumElements = newSize; \
++            if ( (uint64_t) m_maxNumElements * sizeof(type) > 0xFFFFFFFF ) \
++               throw new PlatformException("requested array size exceeds 4GB", ERANGE, __FILE__, __LINE__, __FUNCTION__); /* prevent overflow */ \
+             m_elements = (type*)MP4Realloc(m_elements, \
+                 m_maxNumElements * sizeof(type)); \
+         } \
+diff --git a/src/mp4atom.cpp b/src/mp4atom.cpp
+index 7a0a53f..f5d5dc0 100644
+--- a/src/mp4atom.cpp
++++ b/src/mp4atom.cpp
+@@ -143,6 +143,12 @@ MP4Atom* MP4Atom::ReadAtom(MP4File& file, MP4Atom* pParentAtom)
+         dataSize = file.GetSize() - pos;
+     }
+ 
++    if(dataSize < hdrSize) {
++        ostringstream oss;
++        oss << "Invalid atom size in '" << type << "' atom, dataSize = " << dataSize << " cannot be less than hdrSize = " << static_cast<unsigned>( hdrSize );
++        log.errorf( "%s: \"%s\": %s", __FUNCTION__, file.GetFilename().c_str(), oss.str().c_str() );
++        throw new Exception( oss.str().c_str(), __FILE__, __LINE__, __FUNCTION__ );
++    }
+     dataSize -= hdrSize;
+ 
+     log.verbose1f("\"%s\": type = \"%s\" data-size = %" PRIu64 " (0x%" PRIx64 ") hdr %u",

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14379.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14379.patch
new file mode 100644
index 00000000000..487dc709af3
--- /dev/null
+++ b/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14379.patch
@@ -0,0 +1,33 @@
+Upstream: https://github.com/sergiomb2/libmp4v2/commit/bb920de948c85e3db4a52292ac7250a50e3bfc86
+Gentoo Bug: https://bugs.gentoo.org/661582
+
+From bb920de948c85e3db4a52292ac7250a50e3bfc86 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
+Date: Sat, 2 Nov 2019 04:19:27 +0000
+Subject: [PATCH] Fix v2 Type confusion in MP4v2 2.0.0
+
+The bug is caused by the wrong assumption that the child of an `ilst`
+can never be an `ilst`. So we could fix it by simply adding an ASSERT.
+
+Reference: https://www.openwall.com/lists/oss-security/2018/07/17/1
+Addresses: https://nvd.nist.gov/vuln/detail/CVE-2018-14379
+---
+ src/mp4atom.cpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/mp4atom.cpp b/src/mp4atom.cpp
+index 520cbc8..7a0a53f 100644
+--- a/src/mp4atom.cpp
++++ b/src/mp4atom.cpp
+@@ -778,8 +778,10 @@ MP4Atom::factory( MP4File &file, MP4Atom* parent, const char* type )
+         const char* const ptype = parent->GetType();
+ 
+         if( descendsFrom( parent, "ilst" )) {
+-            if( ATOMID( ptype ) == ATOMID( "ilst" ))
++            if( ATOMID( ptype ) == ATOMID( "ilst" )) {
++                ASSERT(ATOMID( type ) != ATOMID( "ilst" ));
+                 return new MP4ItemAtom( file, type );
++            }
+ 
+             if( ATOMID( type ) == ATOMID( "data" ))
+                 return new MP4DataAtom(file);

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14403.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14403.patch
new file mode 100644
index 00000000000..e7bea4e1dee
--- /dev/null
+++ b/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14403.patch
@@ -0,0 +1,28 @@
+Upstream: https://github.com/sergiomb2/libmp4v2/commit/a94a3372c6ef66a2276cc6cd92f7ec07a9c8bb6b
+Gentoo Bug: https://bugs.gentoo.org/661582
+
+From a94a3372c6ef66a2276cc6cd92f7ec07a9c8bb6b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
+Date: Wed, 17 Oct 2018 16:13:06 +0100
+Subject: [PATCH] Fix Out-of-bounds memory access in MP4v2 2.0.0
+
+The bug can be fixed by more checks when doing type comparison.
+Reference: https://www.openwall.com/lists/oss-security/2018/07/18/3
+
+Addresses https://nvd.nist.gov/vuln/detail/CVE-2018-14403
+---
+ src/mp4util.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/mp4util.cpp b/src/mp4util.cpp
+index 47bd74e..696dab4 100644
+--- a/src/mp4util.cpp
++++ b/src/mp4util.cpp
+@@ -46,6 +46,7 @@ bool MP4NameFirstMatches(const char* s1, const char* s2)
+         s1++;
+         s2++;
+     }
++    if(*s2 != '[' && *s2 != '.' && *s2 != '\0') return false;
+     return true;
+ }
+ 

diff --git a/media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild b/media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild
new file mode 100644
index 00000000000..55a53112dd4
--- /dev/null
+++ b/media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+MY_P=${P/lib}
+
+inherit libtool
+
+DESCRIPTION="Functions for accessing ISO-IEC:14496-1:2001 MPEG-4 standard"
+HOMEPAGE="https://code.google.com/p/mp4v2/"
+SRC_URI="https://mp4v2.googlecode.com/files/${MY_P}.tar.bz2"
+
+LICENSE="MPL-1.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE="static-libs test utils"
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+	test? ( dev-util/dejagnu )
+	utils? ( sys-apps/help2man )
+"
+
+DOCS=( doc/{Authors,BuildSource,Documentation,ReleaseNotes,ToolGuide}.txt README )
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+	"${FILESDIR}/${P}-gcc7.patch"
+	"${FILESDIR}/${P}-mp4tags-corruption.patch"
+	"${FILESDIR}/${P}-clang.patch"
+	"${FILESDIR}/${P}-CVE-2018-14054.patch"
+	"${FILESDIR}/${P}-CVE-2018-14325.patch"
+	"${FILESDIR}/${P}-CVE-2018-14379.patch"
+	"${FILESDIR}/${P}-CVE-2018-14403.patch"
+)
+
+src_prepare() {
+	default
+	elibtoolize
+}
+
+src_configure() {
+	econf \
+		--disable-gch \
+		$(use_enable utils util) \
+		$(use_enable static-libs static)
+}
+
+src_install() {
+	default
+	find "${D}" -name '*.la' -delete || die
+}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/libmp4v2/, media-libs/libmp4v2/files/
@ 2020-08-06 13:25 Jason A. Donenfeld
  0 siblings, 0 replies; 5+ messages in thread
From: Jason A. Donenfeld @ 2020-08-06 13:25 UTC (permalink / raw
  To: gentoo-commits

commit:     45145f7b3d15af680db938c5a3fd78a68502fad7
Author:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  6 13:24:14 2020 +0000
Commit:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Thu Aug  6 13:24:14 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=45145f7b

media-libs/libmp4v2: fix compilation with recent gcc

Closes: https://bugs.gentoo.org/723098
Package-Manager: Portage-3.0.1, Repoman-2.3.23
Signed-off-by: Jason A. Donenfeld <zx2c4 <AT> gentoo.org>

 .../files/libmp4v2-2.0.0-unsigned-int-cast.patch   | 96 ++++++++++++++++++++++
 media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild       |  1 +
 2 files changed, 97 insertions(+)

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-unsigned-int-cast.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-unsigned-int-cast.patch
new file mode 100644
index 00000000000..25830bc596b
--- /dev/null
+++ b/media-libs/libmp4v2/files/libmp4v2-2.0.0-unsigned-int-cast.patch
@@ -0,0 +1,96 @@
+From a5ca35b044bbf13c0b16f0066bf24646604bb218 Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Thu, 6 Aug 2020 15:22:04 +0200
+Subject: [PATCH] Static cast to unsigned int for cases
+
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+---
+ libutil/Utility.cpp  | 2 +-
+ util/mp4art.cpp      | 2 +-
+ util/mp4chaps.cpp    | 2 +-
+ util/mp4file.cpp     | 2 +-
+ util/mp4subtitle.cpp | 2 +-
+ util/mp4track.cpp    | 2 +-
+ 6 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/libutil/Utility.cpp b/libutil/Utility.cpp
+index 76cdd12..d6739d4 100644
+--- a/libutil/Utility.cpp
++++ b/libutil/Utility.cpp
+@@ -493,7 +493,7 @@ Utility::process_impl()
+         if( codes.find( code ) == codes.end() )
+             continue;
+ 
+-        switch( code ) {
++        switch( static_cast<unsigned int>( code ) ) {
+             case 'z':
+                 _optimize = true;
+                 break;
+diff --git a/util/mp4art.cpp b/util/mp4art.cpp
+index add935e..6e7f531 100644
+--- a/util/mp4art.cpp
++++ b/util/mp4art.cpp
+@@ -376,7 +376,7 @@ ArtUtility::utility_option( int code, bool& handled )
+ {
+     handled = true;
+ 
+-    switch( code ) {
++    switch( static_cast<unsigned int> ( code ) ) {
+         case LC_ART_ANY:
+             _artFilter = numeric_limits<uint32_t>::max();
+             break;
+diff --git a/util/mp4chaps.cpp b/util/mp4chaps.cpp
+index 98400f8..ccc8b70 100644
+--- a/util/mp4chaps.cpp
++++ b/util/mp4chaps.cpp
+@@ -632,7 +632,7 @@ ChapterUtility::utility_option( int code, bool& handled )
+ {
+     handled = true;
+ 
+-    switch( code ) {
++    switch( static_cast<unsigned int> ( code ) ) {
+         case 'A':
+         case LC_CHPT_ANY:
+             _ChapterType = MP4ChapterTypeAny;
+diff --git a/util/mp4file.cpp b/util/mp4file.cpp
+index c27844b..b127cd1 100644
+--- a/util/mp4file.cpp
++++ b/util/mp4file.cpp
+@@ -189,7 +189,7 @@ FileUtility::utility_option( int code, bool& handled )
+ {
+     handled = true;
+ 
+-    switch( code ) {
++    switch( static_cast<unsigned int>( code ) ) {
+         case LC_LIST:
+             _action = &FileUtility::actionList;
+             break;
+diff --git a/util/mp4subtitle.cpp b/util/mp4subtitle.cpp
+index 7462153..19d977d 100644
+--- a/util/mp4subtitle.cpp
++++ b/util/mp4subtitle.cpp
+@@ -164,7 +164,7 @@ SubtitleUtility::utility_option( int code, bool& handled )
+ {
+     handled = true;
+ 
+-    switch( code ) {
++    switch( static_cast<unsigned int>( code ) ) {
+         case LC_LIST:
+             _action = &SubtitleUtility::actionList;
+             break;
+diff --git a/util/mp4track.cpp b/util/mp4track.cpp
+index d550506..cd63d7e 100644
+--- a/util/mp4track.cpp
++++ b/util/mp4track.cpp
+@@ -788,7 +788,7 @@ TrackUtility::utility_option( int code, bool& handled )
+ {
+     handled = true;
+ 
+-    switch( code ) {
++    switch( static_cast<unsigned int>( code ) ) {
+         case LC_TRACK_WILDCARD:
+             _trackMode = TM_WILDCARD;
+             break;
+-- 
+2.28.0
+

diff --git a/media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild b/media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild
index 9602704da8a..44a34cb45c5 100644
--- a/media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild
+++ b/media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild
@@ -32,6 +32,7 @@ PATCHES=(
 	"${FILESDIR}/${P}-CVE-2018-14325.patch"
 	"${FILESDIR}/${P}-CVE-2018-14379.patch"
 	"${FILESDIR}/${P}-CVE-2018-14403.patch"
+	"${FILESDIR}/${P}-unsigned-int-cast.patch"
 )
 
 src_prepare() {


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/libmp4v2/, media-libs/libmp4v2/files/
@ 2023-05-17  7:13 Miroslav Šulc
  0 siblings, 0 replies; 5+ messages in thread
From: Miroslav Šulc @ 2023-05-17  7:13 UTC (permalink / raw
  To: gentoo-commits

commit:     d2a2cffd6ad3268b681c1c6978162cee9353c19c
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Wed May 17 07:12:56 2023 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Wed May 17 07:12:56 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2a2cffd

media-libs/libmp4v2: dropped obsolete and vulnerable 2.0.0-r2 & 2.1.2

Bug: https://bugs.gentoo.org/906520
Bug: https://bugs.gentoo.org/905092
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 media-libs/libmp4v2/Manifest                       |  2 -
 .../files/libmp4v2-2.0.0-CVE-2018-14054.patch      | 35 -------------
 .../files/libmp4v2-2.0.0-CVE-2018-14325.patch      | 60 ----------------------
 .../files/libmp4v2-2.0.0-CVE-2018-14379.patch      | 33 ------------
 .../files/libmp4v2-2.0.0-CVE-2018-14403.patch      | 28 ----------
 .../libmp4v2/files/libmp4v2-2.0.0-clang.patch      | 36 -------------
 .../libmp4v2/files/libmp4v2-2.0.0-gcc7.patch       | 18 -------
 .../files/libmp4v2-2.0.0-mp4tags-corruption.patch  | 20 --------
 media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild       | 53 -------------------
 media-libs/libmp4v2/libmp4v2-2.1.2.ebuild          | 32 ------------
 10 files changed, 317 deletions(-)

diff --git a/media-libs/libmp4v2/Manifest b/media-libs/libmp4v2/Manifest
index c67a681a3951..7636b52f390f 100644
--- a/media-libs/libmp4v2/Manifest
+++ b/media-libs/libmp4v2/Manifest
@@ -1,3 +1 @@
-DIST mp4v2-2.0.0.tar.bz2 495672 BLAKE2B 966c90b443bd6f7a81c96fd12f95b00c3ec89cd476aa0fff3e0450b315d54543578ef953c5e3f28d52ca800a0768c601dddc8e99a32ff512767cd65c12832bd5 SHA512 15eb882f33d72d4209053b54c883b67715f539c33096705a0e7bc79015b93f6f3ac80ae29c65a0ffe9eab1bf0dedf07198bdee23fa6eafcd6ccb34f984484be0
-DIST mp4v2-2.1.2.tar.bz2 594365 BLAKE2B ca7438ab34d826926bb39a9f1c09f24a65c2ea7aae45cb736ec4b285ef975f575c1c28ee88d47e623c8085e2800a52ac89d18bd7c42232c72d7d6ae89d78c850 SHA512 7996edbbaf4125cb406ea5dad82dd04e50bc04d6d3f7c32ba5f3be35872b5dc7048038a6e59c668578e8ee1898d56a3c77bcafc5cd42cff9cb6232ee20cdb406
 DIST mp4v2-2.1.3.tar.bz2 594549 BLAKE2B ee8e5792b5b92098e2990bd76a8be7aa6cffc60cb28059702a07eb5cc73dcc9def59dec290f40cbf246069b491d1911714fb00f8d48b77e421e8993fac37f76c SHA512 89bca9c76cf468a932a09d66bc5409266acde51184bf1262c5bc9a524ee5c9a3e073fd0d37450580284e12d9d46d1fd5db0c4ce647c365cc5106fb39ee3d59f6

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14054.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14054.patch
deleted file mode 100644
index 3ff3e731b93c..000000000000
--- a/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14054.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-Upstream: https://github.com/sergiomb2/libmp4v2/commit/3410bc66fb91f46325ab1d008b6a421dd8240949
-Gentoo Bug: https://bugs.gentoo.org/661582
-
-From 3410bc66fb91f46325ab1d008b6a421dd8240949 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
-Date: Sat, 2 Nov 2019 04:21:17 +0000
-Subject: [PATCH] Null out pointer after free to prevent double free
-
-If an exception occurs (because of a crafted MP4) before the value is reassigned, then a double free can occur.  By setting the pointer to NULL after the first free, we prevent the double free in this case.
-Addresses: https://nvd.nist.gov/vuln/detail/CVE-2018-14054
-
-copied form https://github.com/TechSmith/mp4v2/commit/f09cceeee5bd7f783fd31f10e8b3c440ccf4c743
-From: Dave O'Rourke
-Date: Wed, 20 Mar 2019 08:57:29 -0400
----
- src/mp4property.cpp | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/src/mp4property.cpp b/src/mp4property.cpp
-index 9a5b1e3..1b8e1d2 100644
---- a/src/mp4property.cpp
-+++ b/src/mp4property.cpp
-@@ -391,8 +391,10 @@ void MP4StringProperty::Read( MP4File& file, uint32_t index )
-         char*& value = m_values[i];
- 
-         // Generally a default atom setting, e.g. see atom_avc1.cpp, "JVT/AVC Coding"; we'll leak this string if
--        // we don't free.  Note that MP4Free checks for null.
--        MP4Free(value); 
-+        // we don't free.  Note that this code checks for null before calling free and sets the pointer to null
-+        // after freeing it, to prevent a double free in case an exception occurs before the value is reassigned.
-+        MP4Free( value );
-+        value = NULL;
- 
-         if( m_useCountedFormat ) {
-             value = file.ReadCountedString( (m_useUnicode ? 2 : 1), m_useExpandedCount, m_fixedLength );

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14325.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14325.patch
deleted file mode 100644
index eb23926bb49d..000000000000
--- a/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14325.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-Upstream: https://github.com/sergiomb2/libmp4v2/commit/9084868fd9f86bee118001c23171e832f15009f4
-Gentoo Bug: https://bugs.gentoo.org/661582
-
-
-From 9084868fd9f86bee118001c23171e832f15009f4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
-Date: Fri, 8 Nov 2019 02:01:32 +0000
-Subject: [PATCH] Fix v3 Integer underflow/overflow in MP4v2 2.0.0
-
-Reference: https://www.openwall.com/lists/oss-security/2018/07/16/1
-
-For the overflow, we could check the result of the integer multiplication:
-
-fix vulnerability where an atom list size is enormous
-and calculating the number of bytes needed to hold the list overflows
-https://github.com/TechSmith/mp4v2/pull/27/commits/70d823ccd8e2d7d0ed9e62fb7e8983d21e6acbeb
-
-Addresses https://nvd.nist.gov/vuln/detail/CVE-2018-14326 and https://nvd.nist.gov/vuln/detail/CVE-2018-14446
-
-For the underflow, we could check if `dataSize >= hdrSize` satisfies:
-Throw exception when invalid atom size would cause integer underflow
-The calculation `hdrSize - dataSize` can underflow the 64-bit unsigned int dataSize type, which can lead to incorrect results.  We throw an exception to stop the code from going any further.
-
-Addresses https://nvd.nist.gov/vuln/detail/CVE-2018-14325
-Based on https://github.com/TechSmith/mp4v2/commit/e475013c6ef78093055a02b0d035eda0f9f01451
----
- src/mp4array.h  | 2 ++
- src/mp4atom.cpp | 6 ++++++
- 2 files changed, 8 insertions(+)
-
-diff --git a/src/mp4array.h b/src/mp4array.h
-index c49d59b..69d470a 100644
---- a/src/mp4array.h
-+++ b/src/mp4array.h
-@@ -102,6 +102,8 @@ class MP4Array {
-         void Resize(MP4ArrayIndex newSize) { \
-             m_numElements = newSize; \
-             m_maxNumElements = newSize; \
-+            if ( (uint64_t) m_maxNumElements * sizeof(type) > 0xFFFFFFFF ) \
-+               throw new PlatformException("requested array size exceeds 4GB", ERANGE, __FILE__, __LINE__, __FUNCTION__); /* prevent overflow */ \
-             m_elements = (type*)MP4Realloc(m_elements, \
-                 m_maxNumElements * sizeof(type)); \
-         } \
-diff --git a/src/mp4atom.cpp b/src/mp4atom.cpp
-index 7a0a53f..f5d5dc0 100644
---- a/src/mp4atom.cpp
-+++ b/src/mp4atom.cpp
-@@ -143,6 +143,12 @@ MP4Atom* MP4Atom::ReadAtom(MP4File& file, MP4Atom* pParentAtom)
-         dataSize = file.GetSize() - pos;
-     }
- 
-+    if(dataSize < hdrSize) {
-+        ostringstream oss;
-+        oss << "Invalid atom size in '" << type << "' atom, dataSize = " << dataSize << " cannot be less than hdrSize = " << static_cast<unsigned>( hdrSize );
-+        log.errorf( "%s: \"%s\": %s", __FUNCTION__, file.GetFilename().c_str(), oss.str().c_str() );
-+        throw new Exception( oss.str().c_str(), __FILE__, __LINE__, __FUNCTION__ );
-+    }
-     dataSize -= hdrSize;
- 
-     log.verbose1f("\"%s\": type = \"%s\" data-size = %" PRIu64 " (0x%" PRIx64 ") hdr %u",

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14379.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14379.patch
deleted file mode 100644
index 487dc709af39..000000000000
--- a/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14379.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-Upstream: https://github.com/sergiomb2/libmp4v2/commit/bb920de948c85e3db4a52292ac7250a50e3bfc86
-Gentoo Bug: https://bugs.gentoo.org/661582
-
-From bb920de948c85e3db4a52292ac7250a50e3bfc86 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
-Date: Sat, 2 Nov 2019 04:19:27 +0000
-Subject: [PATCH] Fix v2 Type confusion in MP4v2 2.0.0
-
-The bug is caused by the wrong assumption that the child of an `ilst`
-can never be an `ilst`. So we could fix it by simply adding an ASSERT.
-
-Reference: https://www.openwall.com/lists/oss-security/2018/07/17/1
-Addresses: https://nvd.nist.gov/vuln/detail/CVE-2018-14379
----
- src/mp4atom.cpp | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/src/mp4atom.cpp b/src/mp4atom.cpp
-index 520cbc8..7a0a53f 100644
---- a/src/mp4atom.cpp
-+++ b/src/mp4atom.cpp
-@@ -778,8 +778,10 @@ MP4Atom::factory( MP4File &file, MP4Atom* parent, const char* type )
-         const char* const ptype = parent->GetType();
- 
-         if( descendsFrom( parent, "ilst" )) {
--            if( ATOMID( ptype ) == ATOMID( "ilst" ))
-+            if( ATOMID( ptype ) == ATOMID( "ilst" )) {
-+                ASSERT(ATOMID( type ) != ATOMID( "ilst" ));
-                 return new MP4ItemAtom( file, type );
-+            }
- 
-             if( ATOMID( type ) == ATOMID( "data" ))
-                 return new MP4DataAtom(file);

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14403.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14403.patch
deleted file mode 100644
index e7bea4e1dee1..000000000000
--- a/media-libs/libmp4v2/files/libmp4v2-2.0.0-CVE-2018-14403.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-Upstream: https://github.com/sergiomb2/libmp4v2/commit/a94a3372c6ef66a2276cc6cd92f7ec07a9c8bb6b
-Gentoo Bug: https://bugs.gentoo.org/661582
-
-From a94a3372c6ef66a2276cc6cd92f7ec07a9c8bb6b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
-Date: Wed, 17 Oct 2018 16:13:06 +0100
-Subject: [PATCH] Fix Out-of-bounds memory access in MP4v2 2.0.0
-
-The bug can be fixed by more checks when doing type comparison.
-Reference: https://www.openwall.com/lists/oss-security/2018/07/18/3
-
-Addresses https://nvd.nist.gov/vuln/detail/CVE-2018-14403
----
- src/mp4util.cpp | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/mp4util.cpp b/src/mp4util.cpp
-index 47bd74e..696dab4 100644
---- a/src/mp4util.cpp
-+++ b/src/mp4util.cpp
-@@ -46,6 +46,7 @@ bool MP4NameFirstMatches(const char* s1, const char* s2)
-         s1++;
-         s2++;
-     }
-+    if(*s2 != '[' && *s2 != '.' && *s2 != '\0') return false;
-     return true;
- }
- 

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-clang.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-clang.patch
deleted file mode 100644
index 34aa81cc5e0e..000000000000
--- a/media-libs/libmp4v2/files/libmp4v2-2.0.0-clang.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From edc4f0ad8f37bb8aeae4e3ea34766dc6cdbb2f15 Mon Sep 17 00:00:00 2001
-From: David Carlos Manuelda <StormByte@gmail.com>
-Date: Tue, 7 Aug 2018 05:42:28 +0200
-Subject: [PATCH] Fix clang compilation
-
----
- src/mp4.cpp   | 2 +-
- src/mp4util.h | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/mp4.cpp b/src/mp4.cpp
-index 1016f79..d576103 100644
---- a/src/mp4.cpp
-+++ b/src/mp4.cpp
-@@ -896,7 +896,7 @@ MP4FileHandle MP4ReadProvider( const char* fileName, const MP4FileProvider* file
-         }
- 
-         catch (...) {
--            return MP4_INVALID_TRACK_ID;
-+            return (mp4v2_ismacrypParams *)MP4_INVALID_TRACK_ID;
-         }
-     }
- 
-diff --git a/src/mp4util.h b/src/mp4util.h
-index 1fbbd81..b33bb44 100644
---- a/src/mp4util.h
-+++ b/src/mp4util.h
-@@ -33,7 +33,7 @@ namespace mp4v2 { namespace impl {
- #ifndef ASSERT
- #   define ASSERT(expr) \
-         if (!(expr)) { \
--            throw new Exception("assert failure: "LIBMPV42_STRINGIFY((expr)), __FILE__, __LINE__, __FUNCTION__ ); \
-+            throw new Exception("assert failure: " LIBMPV42_STRINGIFY((expr)), __FILE__, __LINE__, __FUNCTION__ ); \
-         }
- #endif
- 
\ No newline at end of file

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-gcc7.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-gcc7.patch
deleted file mode 100644
index 156f0fcbaa0d..000000000000
--- a/media-libs/libmp4v2/files/libmp4v2-2.0.0-gcc7.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-https://bugs.gentoo.org/show_bug.cgi?id=600892
-
-Description: Fix pointer comparison (FTBFS on GCC 7)
-Author: Philip Chung <philipchung1995@yahoo.com>
-Bug-Debian: https://bugs.debian.org/853560
-Last-Update: 2017-09-04
-
---- a/src/rtphint.cpp
-+++ b/src/rtphint.cpp
-@@ -339,7 +339,7 @@ void MP4RtpHintTrack::GetPayload(
-                 pSlash = strchr(pSlash, '/');
-                 if (pSlash != NULL) {
-                     pSlash++;
--                    if (pSlash != '\0') {
-+                    if (*pSlash != '\0') {
-                         length = (uint32_t)strlen(pRtpMap) - (pSlash - pRtpMap);
-                         *ppEncodingParams = (char *)MP4Calloc(length + 1);
-                         strncpy(*ppEncodingParams, pSlash, length);

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-mp4tags-corruption.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-mp4tags-corruption.patch
deleted file mode 100644
index 182d41bb8123..000000000000
--- a/media-libs/libmp4v2/files/libmp4v2-2.0.0-mp4tags-corruption.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-From: "Matteo F. Vescovi" <mfv@debian.org>
-Date: Thu, 5 Nov 2015 15:26:00 +0100
-Subject: Fix_mp4tags_corruption
-
----
- util/mp4tags.cpp | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/util/mp4tags.cpp b/util/mp4tags.cpp
-index 1b9e866..80e89d4 100644
---- a/util/mp4tags.cpp
-+++ b/util/mp4tags.cpp
-@@ -539,6 +539,7 @@ extern "C" int
-                         else {
-                             fprintf( stderr, "Art file %s not found\n", tags[i] );
-                         }
-+                        break;
-                     }
-                     case OPT_ALBUM_ARTIST:
-                         MP4TagsSetAlbumArtist( mdata, tags[i] );

diff --git a/media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild b/media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild
deleted file mode 100644
index a4c1965e9c1b..000000000000
--- a/media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-MY_P=${P/lib}
-
-inherit libtool
-
-DESCRIPTION="Functions for accessing ISO-IEC:14496-1:2001 MPEG-4 standard"
-HOMEPAGE="https://code.google.com/p/mp4v2/"
-SRC_URI="https://mp4v2.googlecode.com/files/${MY_P}.tar.bz2"
-
-LICENSE="MPL-1.1"
-SLOT="0"
-KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x86-solaris"
-IUSE="static-libs utils"
-# Tests need DejaGnu but are non-existent (just an empty framework)
-RESTRICT="test"
-
-BDEPEND="utils? ( sys-apps/help2man )"
-
-DOCS=( doc/{Authors,BuildSource,Documentation,ReleaseNotes,ToolGuide}.txt README )
-
-S="${WORKDIR}/${MY_P}"
-
-PATCHES=(
-	"${FILESDIR}/${P}-gcc7.patch"
-	"${FILESDIR}/${P}-mp4tags-corruption.patch"
-	"${FILESDIR}/${P}-clang.patch"
-	"${FILESDIR}/${P}-CVE-2018-14054.patch"
-	"${FILESDIR}/${P}-CVE-2018-14325.patch"
-	"${FILESDIR}/${P}-CVE-2018-14379.patch"
-	"${FILESDIR}/${P}-CVE-2018-14403.patch"
-	"${FILESDIR}/${P}-unsigned-int-cast.patch"
-)
-
-src_prepare() {
-	default
-	elibtoolize
-}
-
-src_configure() {
-	econf \
-		--disable-gch \
-		$(use_enable utils util) \
-		$(use_enable static-libs static)
-}
-
-src_install() {
-	default
-	find "${D}" -name '*.la' -delete || die
-}

diff --git a/media-libs/libmp4v2/libmp4v2-2.1.2.ebuild b/media-libs/libmp4v2/libmp4v2-2.1.2.ebuild
deleted file mode 100644
index 2b7c38415a27..000000000000
--- a/media-libs/libmp4v2/libmp4v2-2.1.2.ebuild
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-MY_P=${P/lib}
-
-inherit cmake
-
-DESCRIPTION="Functions for accessing ISO-IEC:14496-1:2001 MPEG-4 standard"
-HOMEPAGE="https://mp4v2.org/"
-SRC_URI="https://github.com/enzo1982/mp4v2/releases/download/v${PV}/${MY_P}.tar.bz2"
-
-LICENSE="MPL-1.1"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x86-solaris"
-IUSE="utils"
-# Tests need DejaGnu but are non-existent (just an empty framework)
-RESTRICT="test"
-
-S="${WORKDIR}/${MY_P}"
-
-PATCHES=(
-	"${FILESDIR}/${PN}-2.0.0-unsigned-int-cast.patch"
-)
-
-src_configure() {
-	local mycmakeargs=(
-		-DBUILD_UTILS=$(usex utils)
-	)
-	cmake_src_configure
-}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/libmp4v2/, media-libs/libmp4v2/files/
@ 2023-06-04  7:48 Miroslav Šulc
  0 siblings, 0 replies; 5+ messages in thread
From: Miroslav Šulc @ 2023-06-04  7:48 UTC (permalink / raw
  To: gentoo-commits

commit:     a61d5d15bb1c95d443c0e00c94b5b023d090a889
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Sun Jun  4 07:48:36 2023 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Jun  4 07:48:36 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a61d5d15

media-libs/libmp4v2: fixed mem leaks

Bug: https://bugs.gentoo.org/907275
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../files/libmp4v2-2.0.0-unsigned-int-cast.patch   |  21 ---
 .../files/libmp4v2-2.1.3-mem-leaks-1.patch         | 150 +++++++++++++++++++++
 .../files/libmp4v2-2.1.3-mem-leaks-2.patch         |  30 +++++
 media-libs/libmp4v2/libmp4v2-2.1.3-r1.ebuild       |  34 +++++
 4 files changed, 214 insertions(+), 21 deletions(-)

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.0.0-unsigned-int-cast.patch b/media-libs/libmp4v2/files/libmp4v2-2.0.0-unsigned-int-cast.patch
index 25830bc596be..a5b28c32022f 100644
--- a/media-libs/libmp4v2/files/libmp4v2-2.0.0-unsigned-int-cast.patch
+++ b/media-libs/libmp4v2/files/libmp4v2-2.0.0-unsigned-int-cast.patch
@@ -4,17 +4,6 @@ Date: Thu, 6 Aug 2020 15:22:04 +0200
 Subject: [PATCH] Static cast to unsigned int for cases
 
 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
----
- libutil/Utility.cpp  | 2 +-
- util/mp4art.cpp      | 2 +-
- util/mp4chaps.cpp    | 2 +-
- util/mp4file.cpp     | 2 +-
- util/mp4subtitle.cpp | 2 +-
- util/mp4track.cpp    | 2 +-
- 6 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/libutil/Utility.cpp b/libutil/Utility.cpp
-index 76cdd12..d6739d4 100644
 --- a/libutil/Utility.cpp
 +++ b/libutil/Utility.cpp
 @@ -493,7 +493,7 @@ Utility::process_impl()
@@ -26,8 +15,6 @@ index 76cdd12..d6739d4 100644
              case 'z':
                  _optimize = true;
                  break;
-diff --git a/util/mp4art.cpp b/util/mp4art.cpp
-index add935e..6e7f531 100644
 --- a/util/mp4art.cpp
 +++ b/util/mp4art.cpp
 @@ -376,7 +376,7 @@ ArtUtility::utility_option( int code, bool& handled )
@@ -39,8 +26,6 @@ index add935e..6e7f531 100644
          case LC_ART_ANY:
              _artFilter = numeric_limits<uint32_t>::max();
              break;
-diff --git a/util/mp4chaps.cpp b/util/mp4chaps.cpp
-index 98400f8..ccc8b70 100644
 --- a/util/mp4chaps.cpp
 +++ b/util/mp4chaps.cpp
 @@ -632,7 +632,7 @@ ChapterUtility::utility_option( int code, bool& handled )
@@ -52,8 +37,6 @@ index 98400f8..ccc8b70 100644
          case 'A':
          case LC_CHPT_ANY:
              _ChapterType = MP4ChapterTypeAny;
-diff --git a/util/mp4file.cpp b/util/mp4file.cpp
-index c27844b..b127cd1 100644
 --- a/util/mp4file.cpp
 +++ b/util/mp4file.cpp
 @@ -189,7 +189,7 @@ FileUtility::utility_option( int code, bool& handled )
@@ -65,8 +48,6 @@ index c27844b..b127cd1 100644
          case LC_LIST:
              _action = &FileUtility::actionList;
              break;
-diff --git a/util/mp4subtitle.cpp b/util/mp4subtitle.cpp
-index 7462153..19d977d 100644
 --- a/util/mp4subtitle.cpp
 +++ b/util/mp4subtitle.cpp
 @@ -164,7 +164,7 @@ SubtitleUtility::utility_option( int code, bool& handled )
@@ -78,8 +59,6 @@ index 7462153..19d977d 100644
          case LC_LIST:
              _action = &SubtitleUtility::actionList;
              break;
-diff --git a/util/mp4track.cpp b/util/mp4track.cpp
-index d550506..cd63d7e 100644
 --- a/util/mp4track.cpp
 +++ b/util/mp4track.cpp
 @@ -788,7 +788,7 @@ TrackUtility::utility_option( int code, bool& handled )

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.1.3-mem-leaks-1.patch b/media-libs/libmp4v2/files/libmp4v2-2.1.3-mem-leaks-1.patch
new file mode 100644
index 000000000000..a12c24f4e3fe
--- /dev/null
+++ b/media-libs/libmp4v2/files/libmp4v2-2.1.3-mem-leaks-1.patch
@@ -0,0 +1,150 @@
+From c724815a541b763455ff38922af96f652627bce6 Mon Sep 17 00:00:00 2001
+From: Robert Kausch <robert.kausch@freac.org>
+Date: Tue, 16 May 2023 00:19:02 +0200
+Subject: [PATCH] Fix memory leaks in case MP4File::ReadBytes() throws an
+ exception.
+
+--- a/src/atom_rtp.cpp
++++ b/src/atom_rtp.cpp
+@@ -125,12 +125,19 @@ void MP4RtpAtom::ReadHntiType()
+ 
+     // read sdp string, length is implicit in size of atom
+     uint64_t size = GetEnd() - m_File.GetPosition();
+-    char* data = (char*)MP4Malloc(size + 1);
++    char* data = (char*) MP4Malloc(size + 1);
+     ASSERT(data != NULL);
+-    m_File.ReadBytes((uint8_t*)data, size);
+-    data[size] = '\0';
+-    ((MP4StringProperty*)m_pProperties[1])->SetValue(data);
+-    MP4Free(data);
++    try {
++        m_File.ReadBytes((uint8_t*) data, size);
++        data[size] = '\0';
++        ((MP4StringProperty*) m_pProperties[1])->SetValue(data);
++        MP4Free(data);
++    }
++    catch (Exception*) {
++        // free memory and rethrow
++        MP4Free(data);
++        throw;
++    }
+ }
+ 
+ void MP4RtpAtom::Write()
+--- a/src/atom_sdp.cpp
++++ b/src/atom_sdp.cpp
+@@ -36,12 +36,19 @@ void MP4SdpAtom::Read()
+ {
+     // read sdp string, length is implicit in size of atom
+     uint64_t size = GetEnd() - m_File.GetPosition();
+-    char* data = (char*)MP4Malloc(size + 1);
++    char* data = (char*) MP4Malloc(size + 1);
+     ASSERT(data != NULL);
+-    m_File.ReadBytes((uint8_t*)data, size);
+-    data[size] = '\0';
+-    ((MP4StringProperty*)m_pProperties[0])->SetValue(data);
+-    MP4Free(data);
++    try {
++        m_File.ReadBytes((uint8_t*) data, size);
++        data[size] = '\0';
++        ((MP4StringProperty*) m_pProperties[0])->SetValue(data);
++        MP4Free(data);
++    }
++    catch (Exception*) {
++        // free memory and rethrow
++        MP4Free(data);
++        throw;
++    }
+ }
+ 
+ void MP4SdpAtom::Write()
+--- a/src/mp4file_io.cpp
++++ b/src/mp4file_io.cpp
+@@ -325,19 +325,26 @@ char* MP4File::ReadString()
+ {
+     uint32_t length = 0;
+     uint32_t alloced = 64;
+-    char* data = (char*)MP4Malloc(alloced);
+-
+-    do {
+-        if (length == alloced) {
+-            data = (char*)MP4Realloc(data, alloced * 2);
+-            if (data == NULL) return NULL;
+-            alloced *= 2;
+-        }
+-        ReadBytes((uint8_t*)&data[length], 1);
+-        length++;
+-    } while (data[length - 1] != 0);
+-
+-    data = (char*)MP4Realloc(data, length);
++    char* data = (char*) MP4Malloc(alloced);
++    try {
++        do {
++            if (length == alloced) {
++                data = (char*) MP4Realloc(data, alloced * 2);
++                if (data == NULL)
++                    return NULL;
++                alloced *= 2;
++            }
++            ReadBytes((uint8_t*) &data[length], 1);
++            length++;
++        } while (data[length - 1] != 0);
++
++        data = (char*) MP4Realloc(data, length);
++    }
++    catch (Exception*) {
++        // free memory and rethrow
++        MP4Free(data);
++        throw;
++    }
+     return data;
+ }
+ 
+@@ -384,21 +391,34 @@ char* MP4File::ReadCountedString(uint8_t charSize, bool allowExpandedCount, uint
+     }
+ 
+     uint32_t byteLength = charLength * charSize;
+-    char* data = (char*)MP4Malloc(byteLength + 1);
+-    if (byteLength > 0) {
+-        ReadBytes((uint8_t*)data, byteLength);
+-    }
+-    data[byteLength] = '\0';
+-
+-    // read padding
+-    if (fixedLength) {
+-        const uint8_t padsize = fixedLength - byteLength -1U;
+-        if( padsize ) {
+-            uint8_t* padbuf = (uint8_t*)malloc( padsize );
+-            ReadBytes( padbuf, padsize );
+-            free( padbuf );
++    char* data = (char*) MP4Malloc(byteLength + 1);
++    try {
++        if (byteLength > 0)
++            ReadBytes((uint8_t*) data, byteLength);
++        data[byteLength] = '\0';
++
++        // read padding
++        if (fixedLength) {
++            const uint8_t padsize = fixedLength - byteLength -1U;
++            if (padsize) {
++                uint8_t* padbuf = (uint8_t*) MP4Malloc(padsize);
++                try {
++                    ReadBytes(padbuf, padsize);
++                    MP4Free(padbuf);
++                }
++                catch (Exception*) {
++                    // free memory and rethrow
++                    MP4Free(padbuf);
++                    throw;
++                }
++            }
+         }
+     }
++    catch (Exception*) {
++        // free memory and rethrow
++        MP4Free(data);
++        throw;
++    }
+ 
+     return data;
+ }

diff --git a/media-libs/libmp4v2/files/libmp4v2-2.1.3-mem-leaks-2.patch b/media-libs/libmp4v2/files/libmp4v2-2.1.3-mem-leaks-2.patch
new file mode 100644
index 000000000000..800812a034d3
--- /dev/null
+++ b/media-libs/libmp4v2/files/libmp4v2-2.1.3-mem-leaks-2.patch
@@ -0,0 +1,30 @@
+From 0f97a87685c8fcf9d7b9b21167265b21b1c34cc5 Mon Sep 17 00:00:00 2001
+From: Robert Kausch <robert.kausch@freac.org>
+Date: Tue, 16 May 2023 00:11:53 +0200
+Subject: [PATCH] Fix memory leaks in MP4StringProperty and MP4BytesProperty
+ classes.
+
+--- a/src/mp4property.cpp
++++ b/src/mp4property.cpp
+@@ -343,6 +343,10 @@ void MP4StringProperty::SetCount(uint32_t count)
+ {
+     uint32_t oldCount = m_values.Size();
+ 
++    for (uint32_t i = count; i < oldCount; i++) {
++        MP4Free(m_values[i]);
++    }
++
+     m_values.Resize(count);
+ 
+     for (uint32_t i = oldCount; i < count; i++) {
+@@ -510,6 +514,10 @@ void MP4BytesProperty::SetCount(uint32_t count)
+ {
+     uint32_t oldCount = m_values.Size();
+ 
++    for (uint32_t i = count; i < oldCount; i++) {
++        MP4Free(m_values[i]);
++    }
++
+     m_values.Resize(count);
+     m_valueSizes.Resize(count);
+ 

diff --git a/media-libs/libmp4v2/libmp4v2-2.1.3-r1.ebuild b/media-libs/libmp4v2/libmp4v2-2.1.3-r1.ebuild
new file mode 100644
index 000000000000..99115cb4f656
--- /dev/null
+++ b/media-libs/libmp4v2/libmp4v2-2.1.3-r1.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+MY_P=${P/lib}
+
+inherit cmake
+
+DESCRIPTION="Functions for accessing ISO-IEC:14496-1:2001 MPEG-4 standard"
+HOMEPAGE="https://mp4v2.org/"
+SRC_URI="https://github.com/enzo1982/mp4v2/releases/download/v${PV}/${MY_P}.tar.bz2"
+
+LICENSE="MPL-1.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="utils"
+# Tests need DejaGnu but are non-existent (just an empty framework)
+RESTRICT="test"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-2.0.0-unsigned-int-cast.patch"
+	"${FILESDIR}/${P}-mem-leaks-1.patch"
+	"${FILESDIR}/${P}-mem-leaks-2.patch"
+)
+
+src_configure() {
+	local mycmakeargs=(
+		-DBUILD_UTILS=$(usex utils)
+	)
+	cmake_src_configure
+}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-04  7:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-04  7:48 [gentoo-commits] repo/gentoo:master commit in: media-libs/libmp4v2/, media-libs/libmp4v2/files/ Miroslav Šulc
  -- strict thread matches above, loose matches on Subject: below --
2023-05-17  7:13 Miroslav Šulc
2020-08-06 13:25 Jason A. Donenfeld
2020-08-03  0:49 Sam James
2018-10-03 21:11 Andreas Sturmlechner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox