From 82a326adfbfcff1385abafd8a796c590c82cba5d Mon Sep 17 00:00:00 2001 From: Alexpux Date: Fri, 24 Jan 2014 11:33:43 +0400 Subject: [PATCH] Add libid3tag package. --- .../0001-no-undefined.mingw.patch | 11 ++++ ...002-update-ac-and-silent-rules.mingw.patch | 14 +++++ mingw-w64-libid3tag/10_utf16.patch | 48 ++++++++++++++ mingw-w64-libid3tag/11_unknown_encoding.patch | 37 +++++++++++ mingw-w64-libid3tag/CVE-2008-2109.patch | 11 ++++ mingw-w64-libid3tag/PKGBUILD | 63 +++++++++++++++++++ mingw-w64-libid3tag/id3tag.pc | 10 +++ 7 files changed, 194 insertions(+) create mode 100644 mingw-w64-libid3tag/0001-no-undefined.mingw.patch create mode 100644 mingw-w64-libid3tag/0002-update-ac-and-silent-rules.mingw.patch create mode 100644 mingw-w64-libid3tag/10_utf16.patch create mode 100644 mingw-w64-libid3tag/11_unknown_encoding.patch create mode 100644 mingw-w64-libid3tag/CVE-2008-2109.patch create mode 100644 mingw-w64-libid3tag/PKGBUILD create mode 100644 mingw-w64-libid3tag/id3tag.pc diff --git a/mingw-w64-libid3tag/0001-no-undefined.mingw.patch b/mingw-w64-libid3tag/0001-no-undefined.mingw.patch new file mode 100644 index 0000000000..ef7d0afce4 --- /dev/null +++ b/mingw-w64-libid3tag/0001-no-undefined.mingw.patch @@ -0,0 +1,11 @@ +--- libid3tag-0.15.1b/Makefile.am.orig 2004-02-17 06:11:28 +0400 ++++ libid3tag-0.15.1b/Makefile.am 2012-04-13 21:48:16 +0400 +@@ -90,7 +90,7 @@ + frametype.gperf compat.gperf genre.dat.in \ + debug.c debug.h + +-libid3tag_la_LDFLAGS = -version-info $(version_info) ++libid3tag_la_LDFLAGS = -version-info $(version_info) -no-undefined + + BUILT_SOURCES = frametype.c compat.c genre.dat + diff --git a/mingw-w64-libid3tag/0002-update-ac-and-silent-rules.mingw.patch b/mingw-w64-libid3tag/0002-update-ac-and-silent-rules.mingw.patch new file mode 100644 index 0000000000..4c393edf7c --- /dev/null +++ b/mingw-w64-libid3tag/0002-update-ac-and-silent-rules.mingw.patch @@ -0,0 +1,14 @@ +--- libid3tag-0.15.1b/configure.ac.orig 2013-04-07 23:01:42 +0400 ++++ libid3tag-0.15.1b/configure.ac 2013-04-07 23:02:09 +0400 +@@ -26,9 +26,9 @@ + + AC_CONFIG_SRCDIR([id3tag.h]) + +-AM_INIT_AUTOMAKE ++AM_INIT_AUTOMAKE([silent-rules]) + +-AM_CONFIG_HEADER([config.h]) ++AC_CONFIG_HEADERS([config.h]) + + dnl System type. + diff --git a/mingw-w64-libid3tag/10_utf16.patch b/mingw-w64-libid3tag/10_utf16.patch new file mode 100644 index 0000000000..a3218d26d8 --- /dev/null +++ b/mingw-w64-libid3tag/10_utf16.patch @@ -0,0 +1,48 @@ +#! /bin/sh -e +## 10_utf16.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Handle bogus UTF16 sequences that have a length that is not +## DP: an even number of 8 bit characters. + +if [ $# -lt 1 ]; then + echo "`basename $0`: script expects -patch|-unpatch as argument" >&2 + exit 1 +fi + +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts +patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}" + +case "$1" in + -patch) patch -p1 ${patch_opts} < $0;; + -unpatch) patch -R -p1 ${patch_opts} < $0;; + *) + echo "`basename $0`: script expects -patch|-unpatch as argument" >&2 + exit 1;; +esac + +exit 0 + +@DPATCH@ +diff -urNad libid3tag-0.15.1b/utf16.c /tmp/dpep.tKvO7a/libid3tag-0.15.1b/utf16.c +--- libid3tag-0.15.1b/utf16.c 2006-01-13 15:26:29.000000000 +0100 ++++ /tmp/dpep.tKvO7a/libid3tag-0.15.1b/utf16.c 2006-01-13 15:27:19.000000000 +0100 +@@ -282,5 +282,18 @@ + + free(utf16); + ++ if (end == *ptr && length % 2 != 0) ++ { ++ /* We were called with a bogus length. It should always ++ * be an even number. We can deal with this in a few ways: ++ * - Always give an error. ++ * - Try and parse as much as we can and ++ * - return an error if we're called again when we ++ * already tried to parse everything we can. ++ * - tell that we parsed it, which is what we do here. ++ */ ++ (*ptr)++; ++ } ++ + return ucs4; + } diff --git a/mingw-w64-libid3tag/11_unknown_encoding.patch b/mingw-w64-libid3tag/11_unknown_encoding.patch new file mode 100644 index 0000000000..7387f2f7d4 --- /dev/null +++ b/mingw-w64-libid3tag/11_unknown_encoding.patch @@ -0,0 +1,37 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 11_unknown_encoding.dpatch by Andreas Henriksson +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: In case of an unknown/invalid encoding, id3_parse_string() will +## DP: return NULL, but the return value wasn't checked resulting +## DP: in segfault in id3_ucs4_length(). This is the only place +## DP: the return value wasn't checked. + +@DPATCH@ +diff -urNad libid3tag-0.15.1b~/compat.gperf libid3tag-0.15.1b/compat.gperf +--- libid3tag-0.15.1b~/compat.gperf 2004-01-23 09:41:32.000000000 +0000 ++++ libid3tag-0.15.1b/compat.gperf 2007-01-14 14:36:53.000000000 +0000 +@@ -236,6 +236,10 @@ + + encoding = id3_parse_uint(&data, 1); + string = id3_parse_string(&data, end - data, encoding, 0); ++ if (!string) ++ { ++ continue; ++ } + + if (id3_ucs4_length(string) < 4) { + free(string); +diff -urNad libid3tag-0.15.1b~/parse.c libid3tag-0.15.1b/parse.c +--- libid3tag-0.15.1b~/parse.c 2004-01-23 09:41:32.000000000 +0000 ++++ libid3tag-0.15.1b/parse.c 2007-01-14 14:37:34.000000000 +0000 +@@ -165,6 +165,9 @@ + case ID3_FIELD_TEXTENCODING_UTF_8: + ucs4 = id3_utf8_deserialize(ptr, length); + break; ++ default: ++ /* FIXME: Unknown encoding! Print warning? */ ++ return NULL; + } + + if (ucs4 && !full) { diff --git a/mingw-w64-libid3tag/CVE-2008-2109.patch b/mingw-w64-libid3tag/CVE-2008-2109.patch new file mode 100644 index 0000000000..26c54c5d2c --- /dev/null +++ b/mingw-w64-libid3tag/CVE-2008-2109.patch @@ -0,0 +1,11 @@ +--- field.c.orig 2008-05-05 09:49:15.000000000 -0400 ++++ field.c 2008-05-05 09:49:25.000000000 -0400 +@@ -291,7 +291,7 @@ + + end = *ptr + length; + +- while (end - *ptr > 0) { ++ while (end - *ptr > 0 && **ptr != '\0') { + ucs4 = id3_parse_string(ptr, end - *ptr, *encoding, 0); + if (ucs4 == 0) + goto fail; diff --git a/mingw-w64-libid3tag/PKGBUILD b/mingw-w64-libid3tag/PKGBUILD new file mode 100644 index 0000000000..235ca0160b --- /dev/null +++ b/mingw-w64-libid3tag/PKGBUILD @@ -0,0 +1,63 @@ +# Maintainer: Alexey Pavlov + +_realname=libid3tag +_mingw_suff=mingw-w64-${CARCH} +pkgname="${_mingw_suff}-${_realname}" +pkgver=0.15.1b +pkgrel=1 +pkgdesc="Library for id3 tagging (mingw-w64)" +arch=('any') +url="http://www.underbit.com/products/mad/" +license=("GPL") +makedepends=("${_mingw_suff}-gcc" "${_mingw_suff}-zlib") +depends=("${_mingw_suff}-gcc-libs") +groups=("${_mingw_suff}") +options=('staticlibs' 'strip' '!makeflags') +source=(#"ftp://ftp.mars.org/pub/mpeg/${_realname}-${pkgver}.tar.gz" + http://sourceforge.net/projects/mad/files/${_realname}/${pkgver}/${_realname}-${pkgver}.tar.gz + 0001-no-undefined.mingw.patch + 0002-update-ac-and-silent-rules.mingw.patch + '10_utf16.patch' + '11_unknown_encoding.patch' + 'CVE-2008-2109.patch' + 'id3tag.pc' + ) +md5sums=('e5808ad997ba32c498803822078748c3' + 'd6e03d565052d2267e382e811304ef87' + '2daec906976c5316db171cc117fb697d' + '4f9df4011e6a8c23240fff5de2d05f6e' + '3ca856b97924d48a0fdfeff0bd83ce7d' + 'c51822ea6301b1ca469975f0c9ee8e34' + '9ee16beebe53f8b89f27504ea3d37385') + +prepare() { + cd "$srcdir/${_realname}-$pkgver" + patch -p1 -i ${srcdir}/0001-no-undefined.mingw.patch + patch -p1 -i ${srcdir}/0002-update-ac-and-silent-rules.mingw.patch + patch -p1 -i ${srcdir}/10_utf16.patch + patch -p1 -i ${srcdir}/11_unknown_encoding.patch + patch -Np0 -i ${srcdir}/CVE-2008-2109.patch + + touch NEWS AUTHORS ChangeLog + rm aclocal.m4 + rm Makefile.in + autoreconf -fi +} + +build() { + mkdir -p $srcdir/build-${MINGW_CHOST} && cd $srcdir/build-${MINGW_CHOST} + ../${_realname}-$pkgver/configure \ + --prefix=${MINGW_PREFIX} \ + --build=${MINGW_CHOST} \ + --host=${MINGW_CHOST} \ + --target=${MINGW_CHOST} \ + --enable-shared + make +} + +package() { + cd "${srcdir}/build-${MINGW_CHOST}" + make DESTDIR="$pkgdir" install + install -D -m644 "${srcdir}/id3tag.pc" "${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/id3tag.pc" + sed -e "s|/usr|${MINGW_PREFIX}|g" -i "${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/id3tag.pc" +} diff --git a/mingw-w64-libid3tag/id3tag.pc b/mingw-w64-libid3tag/id3tag.pc new file mode 100644 index 0000000000..82700bb4ec --- /dev/null +++ b/mingw-w64-libid3tag/id3tag.pc @@ -0,0 +1,10 @@ +prefix=/usr +exec_prefix=${prefix}/bin +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: ID3TAG +Description: libid3tag - ID3 tag manipulation library +Version: 0.15.0b +Libs: -L${libdir} -lid3tag -lz +Cflags: \ No newline at end of file