Browse Source

git subrepo clone gitea@gitea.artixlinux.org:packagesL/libmad.git libmad

subrepo:
  subdir:   "libmad"
  merged:   "5f9faa3"
upstream:
  origin:   "gitea@gitea.artixlinux.org:packagesL/libmad.git"
  branch:   "master"
  commit:   "5f9faa3"
git-subrepo:
  version:  "0.4.0"
  origin:   "???"
  commit:   "???"
master
artoo 3 years ago
parent
commit
9079887256
Signed by: artoo
GPG Key ID: 3292CD0BB0DB310B
  1. 5
      libmad/.artixlinux/agent.yaml
  2. 33
      libmad/.gitignore
  3. 12
      libmad/.gitrepo
  4. 3
      libmad/Jenkinsfile
  5. 2
      libmad/README.md
  6. 41
      libmad/repos/extra-x86_64/PKGBUILD
  7. 12
      libmad/repos/extra-x86_64/amd64-64bit.diff
  8. 197
      libmad/repos/extra-x86_64/frame_length.diff
  9. 117
      libmad/repos/extra-x86_64/libmad.patch
  10. 77
      libmad/repos/extra-x86_64/optimize.diff
  11. 41
      libmad/trunk/PKGBUILD
  12. 12
      libmad/trunk/amd64-64bit.diff
  13. 197
      libmad/trunk/frame_length.diff
  14. 117
      libmad/trunk/libmad.patch
  15. 77
      libmad/trunk/optimize.diff

5
libmad/.artixlinux/agent.yaml

@ -0,0 +1,5 @@
%YAML 1.2
---
label: master

33
libmad/.gitignore vendored

@ -0,0 +1,33 @@
# ---> ArchLinuxPackages
*.tar
*.tar.*
*.jar
*.exe
*.msi
*.zip
*.tgz
*.log
*.log.*
*.sig
pkg/
src/
# ---> Archives
*.7z
*.rar
*.gz
*.bzip
*.bz2
*.xz
*.lzma
*.cab
# ---> systemd
*.service
*.socket
*.timer
# ---> snap
*.snap

12
libmad/.gitrepo

@ -0,0 +1,12 @@
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
;
[subrepo]
remote = gitea@gitea.artixlinux.org:packagesL/libmad.git
branch = master
commit = 5f9faa39ade78adb6bc6341d5ce86448b9bd0a0a
parent = f0c7b50e796b478b72b648e8664bff79f2137e63
method = merge
cmdver = 0.4.0

3
libmad/Jenkinsfile vendored

@ -0,0 +1,3 @@
@Library('artix-ci') import org.artixlinux.RepoPackage
PackagePipeline(new RepoPackage(this))

2
libmad/README.md

@ -0,0 +1,2 @@
# libmad

41
libmad/repos/extra-x86_64/PKGBUILD

@ -0,0 +1,41 @@
# $Id$
# Maintainer: Eric Bélanger <eric@archlinux.org>
pkgname=libmad
pkgver=0.15.1b
pkgrel=8
pkgdesc="A high-quality MPEG audio decoder"
arch=('x86_64')
url="http://www.underbit.com/products/mad/"
license=('GPL')
depends=('glibc')
source=(http://downloads.sourceforge.net/sourceforge/mad/${pkgname}-${pkgver}.tar.gz{,.sign}
libmad.patch amd64-64bit.diff frame_length.diff optimize.diff)
sha512sums=('2cad30347fb310dc605c46bacd9da117f447a5cabedd8fefdb24ab5de641429e5ec5ce8af7aefa6a75a3f545d3adfa255e3fa0a2d50971f76bc0c4fc0400cc45'
'SKIP'
'ff815f5aa32aec4230351b258430ca2184c0a44f80845c92b46aedb9942b3cd85c7b3aa575f4f562a5e02f7fadf6f3d6fe06e64d2b65418dbcd10762214695b1'
'4fc15af4ef497220ee75e3798fbf504be2495fded7202b202169440a387573a3b3105a278d6e5c2ae10d2351a6f9b61895ccde323787314605519ffa23bb080f'
'94bcb95f97ba839ecc12d9610f3b6c867f3d732e567343989086b213108120af02f3ebcd2da92352ea2607b6890433df7576026ee92efc57623ab1a64801fa2b'
'bae8ed5860859b3fc0391d24fb4d4dd1bb25ae46b7f2600dd10bf56d0f6a446c982df5748cf19bfa43020155de3bf6638053cb0596db35549db2186f46e09644')
validpgpkeys=('4229B6BBA00DE143B485B74D2CE2036B4BF38A33')
prepare() {
cd ${pkgname}-${pkgver}
patch -p1 -i "${srcdir}/libmad.patch"
patch -p1 -i "${srcdir}/amd64-64bit.diff"
patch -p1 -i "${srcdir}/frame_length.diff"
patch -p1 -i "${srcdir}/optimize.diff"
}
build() {
cd ${pkgname}-${pkgver}
CFLAGS="$CFLAGS -ftree-vectorize -ftree-vectorizer-verbose=1"
autoconf
./configure --prefix=/usr
make
}
package() {
cd ${pkgname}-${pkgver}
make DESTDIR="${pkgdir}" install
}

12
libmad/repos/extra-x86_64/amd64-64bit.diff

@ -0,0 +1,12 @@
Index: libmad-0.15.1b/configure.ac
===================================================================
--- libmad-0.15.1b.orig/configure.ac 2008-03-07 20:33:05.000000000 +0000
+++ libmad-0.15.1b/configure.ac 2008-03-07 20:33:31.000000000 +0000
@@ -233,6 +233,7 @@
then
case "$host" in
i?86-*) FPM="INTEL" ;;
+ x86_64*) FPM="64BIT" ;;
arm*-*) FPM="ARM" ;;
mips*-*) FPM="MIPS" ;;
sparc*-*) FPM="SPARC" ;;

197
libmad/repos/extra-x86_64/frame_length.diff

@ -0,0 +1,197 @@
; You can calculate where the next frame will start depending on things
; like the bitrate. See mad_header_decode(). It seems that when decoding
; the frame you can go past that boundary. This attempts to catch those cases,
; but might not catch all of them.
; For more info see http://bugs.debian.org/508133
Index: libmad-0.15.1b/layer12.c
===================================================================
--- libmad-0.15.1b.orig/layer12.c 2008-12-23 21:38:07.000000000 +0100
+++ libmad-0.15.1b/layer12.c 2008-12-23 21:38:12.000000000 +0100
@@ -134,6 +134,12 @@
for (sb = 0; sb < bound; ++sb) {
for (ch = 0; ch < nch; ++ch) {
nb = mad_bit_read(&stream->ptr, 4);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
if (nb == 15) {
stream->error = MAD_ERROR_BADBITALLOC;
@@ -146,6 +152,12 @@
for (sb = bound; sb < 32; ++sb) {
nb = mad_bit_read(&stream->ptr, 4);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
if (nb == 15) {
stream->error = MAD_ERROR_BADBITALLOC;
@@ -162,6 +174,12 @@
for (ch = 0; ch < nch; ++ch) {
if (allocation[ch][sb]) {
scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
# if defined(OPT_STRICT)
/*
@@ -187,6 +205,12 @@
frame->sbsample[ch][s][sb] = nb ?
mad_f_mul(I_sample(&stream->ptr, nb),
sf_table[scalefactor[ch][sb]]) : 0;
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
}
}
@@ -195,6 +219,12 @@
mad_fixed_t sample;
sample = I_sample(&stream->ptr, nb);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
for (ch = 0; ch < nch; ++ch) {
frame->sbsample[ch][s][sb] =
@@ -403,7 +433,15 @@
nbal = bitalloc_table[offsets[sb]].nbal;
for (ch = 0; ch < nch; ++ch)
+ {
allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
+ }
}
for (sb = bound; sb < sblimit; ++sb) {
@@ -411,6 +449,13 @@
allocation[0][sb] =
allocation[1][sb] = mad_bit_read(&stream->ptr, nbal);
+
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
}
/* decode scalefactor selection info */
@@ -419,6 +464,12 @@
for (ch = 0; ch < nch; ++ch) {
if (allocation[ch][sb])
scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
}
}
@@ -442,6 +493,12 @@
for (ch = 0; ch < nch; ++ch) {
if (allocation[ch][sb]) {
scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
switch (scfsi[ch][sb]) {
case 2:
@@ -452,11 +509,23 @@
case 0:
scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
/* fall through */
case 1:
case 3:
scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
}
if (scfsi[ch][sb] & 1)
@@ -488,6 +557,12 @@
index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
II_samples(&stream->ptr, &qc_table[index], samples);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
for (s = 0; s < 3; ++s) {
frame->sbsample[ch][3 * gr + s][sb] =
@@ -506,6 +581,12 @@
index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
II_samples(&stream->ptr, &qc_table[index], samples);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
for (ch = 0; ch < nch; ++ch) {
for (s = 0; s < 3; ++s) {
Index: libmad-0.15.1b/layer3.c
===================================================================
--- libmad-0.15.1b.orig/layer3.c 2008-12-23 21:38:07.000000000 +0100
+++ libmad-0.15.1b/layer3.c 2008-12-23 21:38:12.000000000 +0100
@@ -2608,6 +2608,12 @@
next_md_begin = 0;
md_len = si.main_data_begin + frame_space - next_md_begin;
+ if (md_len + MAD_BUFFER_GUARD > MAD_BUFFER_MDLEN)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
frame_used = 0;

117
libmad/repos/extra-x86_64/libmad.patch

@ -0,0 +1,117 @@
diff -ruN libmad-0.15.1b.orig/Makefile.am libmad-0.15.1b/Makefile.am
--- libmad-0.15.1b.orig/Makefile.am 2004-02-17 02:02:03.000000000 +0000
+++ libmad-0.15.1b/Makefile.am 2005-08-25 12:08:04.000000000 +0000
@@ -33,9 +33,12 @@
minimad_INCLUDES =
minimad_LDADD = libmad.la
-EXTRA_DIST = mad.h.sed \
+EXTRA_DIST = mad.h.sed mad.pc.in \
CHANGES COPYRIGHT CREDITS README TODO VERSION
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA= mad.pc
+
exported_headers = version.h fixed.h bit.h timer.h stream.h frame.h \
synth.h decoder.h
diff -ruN libmad-0.15.1b.orig/Makefile.in libmad-0.15.1b/Makefile.in
--- libmad-0.15.1b.orig/Makefile.in 2004-02-17 02:33:23.000000000 +0000
+++ libmad-0.15.1b/Makefile.in 2005-08-25 12:09:34.000000000 +0000
@@ -14,6 +14,8 @@
@SET_MAKE@
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = mad.pc
SOURCES = $(libmad_la_SOURCES) $(EXTRA_libmad_la_SOURCES) $(minimad_SOURCES)
@@ -43,7 +45,7 @@
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(srcdir)/libmad.list.in \
$(top_srcdir)/configure COPYING INSTALL TODO config.guess \
- config.sub depcomp install-sh ltmain.sh missing mkinstalldirs
+ config.sub depcomp install-sh ltmain.sh missing mkinstalldirs mad.pc.in
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -53,7 +55,7 @@
configure.lineno configure.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES = libmad.list
+CONFIG_CLEAN_FILES = libmad.list mad.pc
am__installdirs = $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
@@ -218,7 +220,7 @@
minimad_SOURCES = minimad.c
minimad_INCLUDES =
minimad_LDADD = libmad.la
-EXTRA_DIST = mad.h.sed \
+EXTRA_DIST = mad.h.sed mad.pc.in \
CHANGES COPYRIGHT CREDITS README TODO VERSION
exported_headers = version.h fixed.h bit.h timer.h stream.h frame.h \
@@ -298,6 +300,28 @@
rm -f stamp-h1
touch $@
+mad.pc: $(top_builddir)/config.status mad.pc.in
+ cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+install-pkgconfigDATA: $(pkgconfig_DATA)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(pkgconfigdir)
+ @list='$(pkgconfig_DATA)'; for p in $$list; do \
+ if test -f $(srcdir)/$$p; then \
+ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p"; \
+ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p; \
+ else if test -f $$p; then \
+ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p"; \
+ $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p; \
+ fi; fi; \
+ done
+
+uninstall-pkgconfigDATA:
+ @$(NORMAL_UNINSTALL)
+ list='$(pkgconfig_DATA)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(pkgconfigdir)/$$p; \
+ done
+
distclean-hdr:
-rm -f config.h stamp-h1
libmad.list: $(top_builddir)/config.status $(srcdir)/libmad.list.in
@@ -726,7 +750,7 @@
info-am:
-install-data-am: install-includeHEADERS
+install-data-am: install-includeHEADERS install-pkgconfigDATA
install-exec-am: install-libLTLIBRARIES
@@ -757,7 +781,7 @@
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-info-am \
- uninstall-libLTLIBRARIES
+ uninstall-libLTLIBRARIES install-pkgconfigDATA
uninstall-info: uninstall-info-recursive
diff -ruN libmad-0.15.1b.orig/mad.pc.in libmad-0.15.1b/mad.pc.in
--- libmad-0.15.1b.orig/mad.pc.in 1970-01-01 00:00:00.000000000 +0000
+++ libmad-0.15.1b/mad.pc.in 2005-08-25 12:08:04.000000000 +0000
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: MAD
+Description: libmad - MPEG audio decoder library
+Version: @VERSION@
+Libs: -L${libdir} -lmad
+Cflags:

77
libmad/repos/extra-x86_64/optimize.diff

@ -0,0 +1,77 @@
Index: libmad-0.15.1b/configure.ac
===================================================================
--- libmad-0.15.1b.orig/configure.ac 2008-03-07 20:31:23.000000000 +0000
+++ libmad-0.15.1b/configure.ac 2008-03-07 20:34:26.000000000 +0000
@@ -124,71 +124,7 @@
if test "$GCC" = yes
then
- if test -z "$arch"
- then
- case "$host" in
- i386-*) ;;
- i?86-*) arch="-march=i486" ;;
- arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;;
- armv4*-*) arch="-march=armv4 -mtune=strongarm" ;;
- powerpc-*) ;;
- mips*-agenda-*) arch="-mcpu=vr4100" ;;
- mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;;
- esac
- fi
-
- case "$optimize" in
- -O|"-O "*)
- optimize="-O"
- optimize="$optimize -fforce-mem"
- optimize="$optimize -fforce-addr"
- : #x optimize="$optimize -finline-functions"
- : #- optimize="$optimize -fstrength-reduce"
- optimize="$optimize -fthread-jumps"
- optimize="$optimize -fcse-follow-jumps"
- optimize="$optimize -fcse-skip-blocks"
- : #x optimize="$optimize -frerun-cse-after-loop"
- : #x optimize="$optimize -frerun-loop-opt"
- : #x optimize="$optimize -fgcse"
- optimize="$optimize -fexpensive-optimizations"
- optimize="$optimize -fregmove"
- : #* optimize="$optimize -fdelayed-branch"
- : #x optimize="$optimize -fschedule-insns"
- optimize="$optimize -fschedule-insns2"
- : #? optimize="$optimize -ffunction-sections"
- : #? optimize="$optimize -fcaller-saves"
- : #> optimize="$optimize -funroll-loops"
- : #> optimize="$optimize -funroll-all-loops"
- : #x optimize="$optimize -fmove-all-movables"
- : #x optimize="$optimize -freduce-all-givs"
- : #? optimize="$optimize -fstrict-aliasing"
- : #* optimize="$optimize -fstructure-noalias"
-
- case "$host" in
- arm*-*)
- optimize="$optimize -fstrength-reduce"
- ;;
- mips*-*)
- optimize="$optimize -fstrength-reduce"
- optimize="$optimize -finline-functions"
- ;;
- i?86-*)
- optimize="$optimize -fstrength-reduce"
- ;;
- powerpc-apple-*)
- # this triggers an internal compiler error with gcc2
- : #optimize="$optimize -fstrength-reduce"
-
- # this is really only beneficial with gcc3
- : #optimize="$optimize -finline-functions"
- ;;
- *)
- # this sometimes provokes bugs in gcc 2.95.2
- : #optimize="$optimize -fstrength-reduce"
- ;;
- esac
- ;;
- esac
+ optimize="-O2"
fi
case "$host" in

41
libmad/trunk/PKGBUILD

@ -0,0 +1,41 @@
# $Id$
# Maintainer: Eric Bélanger <eric@archlinux.org>
pkgname=libmad
pkgver=0.15.1b
pkgrel=8
pkgdesc="A high-quality MPEG audio decoder"
arch=('x86_64')
url="http://www.underbit.com/products/mad/"
license=('GPL')
depends=('glibc')
source=(http://downloads.sourceforge.net/sourceforge/mad/${pkgname}-${pkgver}.tar.gz{,.sign}
libmad.patch amd64-64bit.diff frame_length.diff optimize.diff)
sha512sums=('2cad30347fb310dc605c46bacd9da117f447a5cabedd8fefdb24ab5de641429e5ec5ce8af7aefa6a75a3f545d3adfa255e3fa0a2d50971f76bc0c4fc0400cc45'
'SKIP'
'ff815f5aa32aec4230351b258430ca2184c0a44f80845c92b46aedb9942b3cd85c7b3aa575f4f562a5e02f7fadf6f3d6fe06e64d2b65418dbcd10762214695b1'
'4fc15af4ef497220ee75e3798fbf504be2495fded7202b202169440a387573a3b3105a278d6e5c2ae10d2351a6f9b61895ccde323787314605519ffa23bb080f'
'94bcb95f97ba839ecc12d9610f3b6c867f3d732e567343989086b213108120af02f3ebcd2da92352ea2607b6890433df7576026ee92efc57623ab1a64801fa2b'
'bae8ed5860859b3fc0391d24fb4d4dd1bb25ae46b7f2600dd10bf56d0f6a446c982df5748cf19bfa43020155de3bf6638053cb0596db35549db2186f46e09644')
validpgpkeys=('4229B6BBA00DE143B485B74D2CE2036B4BF38A33')
prepare() {
cd ${pkgname}-${pkgver}
patch -p1 -i "${srcdir}/libmad.patch"
patch -p1 -i "${srcdir}/amd64-64bit.diff"
patch -p1 -i "${srcdir}/frame_length.diff"
patch -p1 -i "${srcdir}/optimize.diff"
}
build() {
cd ${pkgname}-${pkgver}
CFLAGS="$CFLAGS -ftree-vectorize -ftree-vectorizer-verbose=1"
autoconf
./configure --prefix=/usr
make
}
package() {
cd ${pkgname}-${pkgver}
make DESTDIR="${pkgdir}" install
}

12
libmad/trunk/amd64-64bit.diff

@ -0,0 +1,12 @@
Index: libmad-0.15.1b/configure.ac
===================================================================
--- libmad-0.15.1b.orig/configure.ac 2008-03-07 20:33:05.000000000 +0000
+++ libmad-0.15.1b/configure.ac 2008-03-07 20:33:31.000000000 +0000
@@ -233,6 +233,7 @@
then
case "$host" in
i?86-*) FPM="INTEL" ;;
+ x86_64*) FPM="64BIT" ;;
arm*-*) FPM="ARM" ;;
mips*-*) FPM="MIPS" ;;
sparc*-*) FPM="SPARC" ;;

197
libmad/trunk/frame_length.diff

@ -0,0 +1,197 @@
; You can calculate where the next frame will start depending on things
; like the bitrate. See mad_header_decode(). It seems that when decoding
; the frame you can go past that boundary. This attempts to catch those cases,
; but might not catch all of them.
; For more info see http://bugs.debian.org/508133
Index: libmad-0.15.1b/layer12.c
===================================================================
--- libmad-0.15.1b.orig/layer12.c 2008-12-23 21:38:07.000000000 +0100
+++ libmad-0.15.1b/layer12.c 2008-12-23 21:38:12.000000000 +0100
@@ -134,6 +134,12 @@
for (sb = 0; sb < bound; ++sb) {
for (ch = 0; ch < nch; ++ch) {
nb = mad_bit_read(&stream->ptr, 4);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
if (nb == 15) {
stream->error = MAD_ERROR_BADBITALLOC;
@@ -146,6 +152,12 @@
for (sb = bound; sb < 32; ++sb) {
nb = mad_bit_read(&stream->ptr, 4);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
if (nb == 15) {
stream->error = MAD_ERROR_BADBITALLOC;
@@ -162,6 +174,12 @@
for (ch = 0; ch < nch; ++ch) {
if (allocation[ch][sb]) {
scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
# if defined(OPT_STRICT)
/*
@@ -187,6 +205,12 @@
frame->sbsample[ch][s][sb] = nb ?
mad_f_mul(I_sample(&stream->ptr, nb),
sf_table[scalefactor[ch][sb]]) : 0;
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
}
}
@@ -195,6 +219,12 @@
mad_fixed_t sample;
sample = I_sample(&stream->ptr, nb);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
for (ch = 0; ch < nch; ++ch) {
frame->sbsample[ch][s][sb] =
@@ -403,7 +433,15 @@
nbal = bitalloc_table[offsets[sb]].nbal;
for (ch = 0; ch < nch; ++ch)
+ {
allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
+ }
}
for (sb = bound; sb < sblimit; ++sb) {
@@ -411,6 +449,13 @@
allocation[0][sb] =
allocation[1][sb] = mad_bit_read(&stream->ptr, nbal);
+
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
}
/* decode scalefactor selection info */
@@ -419,6 +464,12 @@
for (ch = 0; ch < nch; ++ch) {
if (allocation[ch][sb])
scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
}
}
@@ -442,6 +493,12 @@
for (ch = 0; ch < nch; ++ch) {
if (allocation[ch][sb]) {
scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
switch (scfsi[ch][sb]) {
case 2:
@@ -452,11 +509,23 @@
case 0:
scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
/* fall through */
case 1:
case 3:
scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
}
if (scfsi[ch][sb] & 1)
@@ -488,6 +557,12 @@
index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
II_samples(&stream->ptr, &qc_table[index], samples);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
for (s = 0; s < 3; ++s) {
frame->sbsample[ch][3 * gr + s][sb] =
@@ -506,6 +581,12 @@
index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
II_samples(&stream->ptr, &qc_table[index], samples);
+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
for (ch = 0; ch < nch; ++ch) {
for (s = 0; s < 3; ++s) {
Index: libmad-0.15.1b/layer3.c
===================================================================
--- libmad-0.15.1b.orig/layer3.c 2008-12-23 21:38:07.000000000 +0100
+++ libmad-0.15.1b/layer3.c 2008-12-23 21:38:12.000000000 +0100
@@ -2608,6 +2608,12 @@
next_md_begin = 0;
md_len = si.main_data_begin + frame_space - next_md_begin;
+ if (md_len + MAD_BUFFER_GUARD > MAD_BUFFER_MDLEN)
+ {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ stream->sync = 0;
+ return -1;
+ }
frame_used = 0;

117
libmad/trunk/libmad.patch

@ -0,0 +1,117 @@
diff -ruN libmad-0.15.1b.orig/Makefile.am libmad-0.15.1b/Makefile.am
--- libmad-0.15.1b.orig/Makefile.am 2004-02-17 02:02:03.000000000 +0000
+++ libmad-0.15.1b/Makefile.am 2005-08-25 12:08:04.000000000 +0000
@@ -33,9 +33,12 @@
minimad_INCLUDES =
minimad_LDADD = libmad.la
-EXTRA_DIST = mad.h.sed \
+EXTRA_DIST = mad.h.sed mad.pc.in \
CHANGES COPYRIGHT CREDITS README TODO VERSION
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA= mad.pc
+
exported_headers = version.h fixed.h bit.h timer.h stream.h frame.h \
synth.h decoder.h
diff -ruN libmad-0.15.1b.orig/Makefile.in libmad-0.15.1b/Makefile.in
--- libmad-0.15.1b.orig/Makefile.in 2004-02-17 02:33:23.000000000 +0000
+++ libmad-0.15.1b/Makefile.in 2005-08-25 12:09:34.000000000 +0000
@@ -14,6 +14,8 @@
@SET_MAKE@
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = mad.pc
SOURCES = $(libmad_la_SOURCES) $(EXTRA_libmad_la_SOURCES) $(minimad_SOURCES)
@@ -43,7 +45,7 @@
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(srcdir)/libmad.list.in \
$(top_srcdir)/configure COPYING INSTALL TODO config.guess \
- config.sub depcomp install-sh ltmain.sh missing mkinstalldirs
+ config.sub depcomp install-sh ltmain.sh missing mkinstalldirs mad.pc.in
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -53,7 +55,7 @@
configure.lineno configure.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES = libmad.list
+CONFIG_CLEAN_FILES = libmad.list mad.pc
am__installdirs = $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
@@ -218,7 +220,7 @@
minimad_SOURCES = minimad.c
minimad_INCLUDES =
minimad_LDADD = libmad.la
-EXTRA_DIST = mad.h.sed \
+EXTRA_DIST = mad.h.sed mad.pc.in \
CHANGES COPYRIGHT CREDITS README TODO VERSION
exported_headers = version.h fixed.h bit.h timer.h stream.h frame.h \
@@ -298,6 +300,28 @@
rm -f stamp-h1
touch $@
+mad.pc: $(top_builddir)/config.status mad.pc.in
+ cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+install-pkgconfigDATA: $(pkgconfig_DATA)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(pkgconfigdir)
+ @list='$(pkgconfig_DATA)'; for p in $$list; do \
+ if test -f $(srcdir)/$$p; then \
+ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p"; \
+ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p; \
+ else if test -f $$p; then \
+ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p"; \
+ $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p; \
+ fi; fi; \
+ done
+
+uninstall-pkgconfigDATA:
+ @$(NORMAL_UNINSTALL)
+ list='$(pkgconfig_DATA)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(pkgconfigdir)/$$p; \
+ done
+
distclean-hdr:
-rm -f config.h stamp-h1
libmad.list: $(top_builddir)/config.status $(srcdir)/libmad.list.in
@@ -726,7 +750,7 @@
info-am:
-install-data-am: install-includeHEADERS
+install-data-am: install-includeHEADERS install-pkgconfigDATA
install-exec-am: install-libLTLIBRARIES
@@ -757,7 +781,7 @@
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-info-am \
- uninstall-libLTLIBRARIES
+ uninstall-libLTLIBRARIES install-pkgconfigDATA
uninstall-info: uninstall-info-recursive
diff -ruN libmad-0.15.1b.orig/mad.pc.in libmad-0.15.1b/mad.pc.in
--- libmad-0.15.1b.orig/mad.pc.in 1970-01-01 00:00:00.000000000 +0000
+++ libmad-0.15.1b/mad.pc.in 2005-08-25 12:08:04.000000000 +0000
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: MAD
+Description: libmad - MPEG audio decoder library
+Version: @VERSION@
+Libs: -L${libdir} -lmad
+Cflags:

77
libmad/trunk/optimize.diff

@ -0,0 +1,77 @@
Index: libmad-0.15.1b/configure.ac
===================================================================
--- libmad-0.15.1b.orig/configure.ac 2008-03-07 20:31:23.000000000 +0000
+++ libmad-0.15.1b/configure.ac 2008-03-07 20:34:26.000000000 +0000
@@ -124,71 +124,7 @@
if test "$GCC" = yes
then
- if test -z "$arch"
- then
- case "$host" in
- i386-*) ;;
- i?86-*) arch="-march=i486" ;;
- arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;;
- armv4*-*) arch="-march=armv4 -mtune=strongarm" ;;
- powerpc-*) ;;
- mips*-agenda-*) arch="-mcpu=vr4100" ;;
- mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;;
- esac
- fi
-
- case "$optimize" in
- -O|"-O "*)
- optimize="-O"
- optimize="$optimize -fforce-mem"
- optimize="$optimize -fforce-addr"
- : #x optimize="$optimize -finline-functions"
- : #- optimize="$optimize -fstrength-reduce"
- optimize="$optimize -fthread-jumps"
- optimize="$optimize -fcse-follow-jumps"
- optimize="$optimize -fcse-skip-blocks"
- : #x optimize="$optimize -frerun-cse-after-loop"
- : #x optimize="$optimize -frerun-loop-opt"
- : #x optimize="$optimize -fgcse"
- optimize="$optimize -fexpensive-optimizations"
- optimize="$optimize -fregmove"
- : #* optimize="$optimize -fdelayed-branch"
- : #x optimize="$optimize -fschedule-insns"
- optimize="$optimize -fschedule-insns2"
- : #? optimize="$optimize -ffunction-sections"
- : #? optimize="$optimize -fcaller-saves"
- : #> optimize="$optimize -funroll-loops"
- : #> optimize="$optimize -funroll-all-loops"
- : #x optimize="$optimize -fmove-all-movables"
- : #x optimize="$optimize -freduce-all-givs"
- : #? optimize="$optimize -fstrict-aliasing"
- : #* optimize="$optimize -fstructure-noalias"
-
- case "$host" in
- arm*-*)
- optimize="$optimize -fstrength-reduce"
- ;;
- mips*-*)
- optimize="$optimize -fstrength-reduce"
- optimize="$optimize -finline-functions"
- ;;
- i?86-*)
- optimize="$optimize -fstrength-reduce"
- ;;
- powerpc-apple-*)
- # this triggers an internal compiler error with gcc2
- : #optimize="$optimize -fstrength-reduce"
-
- # this is really only beneficial with gcc3
- : #optimize="$optimize -finline-functions"
- ;;
- *)
- # this sometimes provokes bugs in gcc 2.95.2
- : #optimize="$optimize -fstrength-reduce"
- ;;
- esac
- ;;
- esac
+ optimize="-O2"
fi
case "$host" in
Loading…
Cancel
Save