1--- libmad-0.15.1b.orig/debian/changelog
2+++ libmad-0.15.1b/debian/changelog
3@@ -0,0 +1,329 @@
4+libmad (0.15.1b-10) unstable; urgency=medium
5+
6+  * Remove old alioth list as maintainer (Closes: #899582)
7+  * Remove Sam Clegg from uploaders
8+  * Add upstream signing key
9+  * Update watch file to find the signature file
10+
11+ -- Kurt Roeckx <kurt@roeckx.be>  Sun, 10 Mar 2019 16:42:14 +0100
12+
13+libmad (0.15.1b-9) unstable; urgency=high
14+
15+  * Properly check the size of the main data. The previous patch
16+    only checked that it could fit in the buffer, but didn't ensure there
17+    was actually enough room free in the buffer. This was assigned both
18+    CVE-2017-8372 and CVE-2017-8373, but they are really the same, just a
19+    different way to detect it. (Closes: #287519)
20+  * Rewrite patch to check the size of buffer. It now checks it before reading
21+    it instead of afterwards checking that we did read too much. This now also
22+    covers parsing the frame and layer3, not just layer 1 and 2. This was
23+    original reported in #508133. CVE-2017-8374 mentions a case in layer 3.
24+
25+ -- Kurt Roeckx <kurt@roeckx.be>  Sun, 28 Jan 2018 16:28:46 +0100
26+
27+libmad (0.15.1b-8.1) unstable; urgency=medium
28+
29+  * Non-maintainer upload.
30+  * Remove Clément Stenac from Uploaders (Closes: #868708)
31+
32+  [ Helmut Grohne ]
33+  * Move mad.pc to a multiarch location. (Closes: #850461)
34+
35+ -- Manuel A. Fernandez Montecelo <mafm@debian.org>  Tue, 31 Oct 2017 22:16:36 +0100
36+
37+libmad (0.15.1b-8) unstable; urgency=low
38+
39+  * Add multiarch support.  (Closes: #653676)
40+    Patch by Steve Langasek <steve.langasek@canonical.com>
41+  * Use dh-autoreconf to update libtool so that it works on x32
42+    (Closes: #700437)
43+
44+ -- Kurt Roeckx <kurt@roeckx.be>  Mon, 20 May 2013 18:02:18 +0200
45+
46+libmad (0.15.1b-7) unstable; urgency=low
47+
48+  * Fix arm's MAD_F_MLN thumb case causing problems on arhmf.  Patch
49+    by Dave Martin (Closes: #656814)
50+  * Add ${misc:Depends} to the Depends.
51+
52+ -- Kurt Roeckx <kurt@roeckx.be>  Sun, 22 Jan 2012 23:02:29 +0100
53+
54+libmad (0.15.1b-6) unstable; urgency=low
55+
56+  [ Konstantinos Margaritis ]
57+  * Add support for armhf (Closes: #596936)
58+    - libmad.thumb.diff: use "adr" instead of "add" to make code ready for
59+      thumb2
60+    - Provide-Thumb-2-alternative-code-for-MAD_F_MLN.diff: fix another
61+      ftbfs with thumb2 as "rsc" doesnt exist anymore - thanks to Dave
62+      Martin for this patch
63+
64+ -- Kurt Roeckx <kurt@roeckx.be>  Tue, 29 Mar 2011 22:26:22 +0200
65+
66+libmad (0.15.1b-5) unstable; urgency=low
67+
68+  * gcc-4.4 removed an assembler constraint on mips/mipsel.  Use the new
69+    way of doing it.  (Closes: #568418)
70+
71+ -- Kurt Roeckx <kurt@roeckx.be>  Fri, 19 Feb 2010 20:51:00 +0100
72+
73+libmad (0.15.1b-4) unstable; urgency=low
74+
75+  * On an invalid mpeg file we can go past the end of the buffer.
76+    (Closes: #508133)
77+
78+ -- Kurt Roeckx <kurt@roeckx.be>  Tue, 23 Dec 2008 21:38:34 +0100
79+
80+libmad (0.15.1b-3) unstable; urgency=low
81+
82+  * Acknowledge NMU
83+  * Use DEB_DH_MAKESHLIBS_ARGS_libmad0 instead to set shlibs.
84+  * Update Clément Stenac's email address to use zorglub@debian.org
85+  * Add build dependency on autotools-dev, quilt
86+  * Don't use -O plus some other -f options, just use -O2.  (Closes: #415279)
87+  * Use the 64bit fixed point math on amd64 to have a higher quality
88+    output than the default.  (Closes: #465438)
89+  * Bump shlibs since it changes the size of mad_build on amd64.
90+  * Add compat file, level 5.  Change build dependency of debhelper to 5.
91+  * Don't set -lm in the mad.pc file.  libmad doesn't use any math function.
92+  * Remove libmad0 Depends on pkg-config.
93+  * Change to Standards-Version 3.7.3:
94+    - Change ${Source-Version} into ${binary:Version}
95+
96+ -- Kurt Roeckx <kurt@roeckx.be>  Sat, 15 Mar 2008 13:51:31 +0000
97+
98+libmad (0.15.1b-2.1) unstable; urgency=high
99+
100+  * Non-maintainer upload, not targetted for Sarge.
101+  * Urgency high because this is generating uploads with broken depends
102+    that may be propagating to testing (see #311488).
103+  * debian/rules: set DEB_DH_MAKESHLIBS_ARGS_ALL = -V 'libmad0 (>= 0.15.1b)'
104+    to restore the updated shlibs lost in the switch to CDBS
105+    (closes: #310311).
106+
107+ -- Jordi Mallach <jordi@debian.org>  Wed,  1 Jun 2005 17:12:24 +0200
108+
109+libmad (0.15.1b-2) unstable; urgency=low
110+
111+  * Sam Clegg :
112+    * debian/control: update Maintainer: and Uploaders: (closes: #300097)
113+    * debian/rules: convert to CDBS
114+    * debian/control: build-depend on debhelper >= 4.1.0
115+    * debian/libmad0.postinst: removed since debhelper runs ldconfig for us.
116+    * debian/libmad0*.files: removed; use dh_install instead.
117+  * Clément Stenac :
118+    * Better copyright file
119+  * Kurt Roeckx
120+    * Add watch file.
121+
122+ -- Sam Clegg <samo@debian.org>  Sun,  8 May 2005 18:59:49 +0100
123+
124+libmad (0.15.1b-1.1) unstable; urgency=low
125+
126+  * Orphaning this package, setting maintainer to QA.
127+
128+ -- Kyle McMartin <kyle@debian.org>  Thu, 17 Mar 2005 10:59:11 -0500
129+
130+libmad (0.15.1b-1) unstable; urgency=low
131+
132+  * New upstream version. (closes: #252902)
133+  * Removed TODO from installed documentation.
134+  * Added minimad.c to the libmad0-dev documentation. Thanks to
135+    Mario Lang for the patch. (closes: #249067)
136+
137+ -- Kyle McMartin <kyle@debian.org>  Sat, 5 Jun 2004 18:52:00 -0400
138+
139+libmad (0.15.0b-3) unstable; urgency=low
140+
141+  * Updated section from devel to libdevel as per mail.
142+
143+ -- Kyle McMartin <kyle@debian.org>  Tue, 21 Oct 2003 22:40:08 -0400
144+
145+libmad (0.15.0b-2) unstable; urgency=low
146+
147+  * Updated pkgconfig Version entry for mad (closes: #203656)
148+
149+ -- Kyle McMartin <kyle@debian.org>  Tue, 21 Oct 2003 22:09:04 -0400
150+
151+libmad (0.15.0b-1) unstable; urgency=low
152+
153+  * New upstream version(s).
154+  * Split package into each library, as upstream has done.
155+
156+ -- Kyle McMartin <kyle@debian.org>  Sat, 21 Jun 2003 14:21:42 -0400
157+
158+mad (0.14.2b-7) unstable; urgency=low
159+
160+  * Clean up some lintian warnings.
161+  * Fixed id3tag.pc, accidently had -L instead of -I.
162+
163+ -- Kyle McMartin <kyle@debian.org>  Tue, 28 Jan 2003 09:45:02 -0500
164+
165+mad (0.14.2b-6) unstable; urgency=medium
166+
167+  * Updated config.* (closes: #168663)
168+
169+ -- Kyle McMartin <kyle@debian.org>  Thu, 14 Nov 2002 18:41:29 -0500
170+
171+mad (0.14.2b-5) unstable; urgency=medium
172+
173+  * Added build-dep on libesd0-dev, this should fix some
174+    problems people have been having when using esd as the
175+    output device... (closes: #150823)
176+
177+ -- Kyle McMartin <kyle@debian.org>  Wed, 06 Nov 2002 18:20:18 -0500
178+
179+mad (0.14.2b-4) unstable; urgency=low
180+
181+  * added pkgconfig entry, and dependancy on pkg-config. (closes: #144481)
182+
183+ -- Kyle McMartin <kyle@debian.org>  Mon, 05 Aug 2002 14:37:00 -0400
184+
185+mad (0.14.2b-3) unstable; urgency=high
186+
187+  * updated libid3tag0-dev depends to account for zlib1g-dev (closes: #142611)
188+
189+ -- Kyle McMartin <kyle@debian.org>  Thu, 18 Apr 2002 19:37:00 -0500
190+
191+mad (0.14.2b-2) unstable; urgency=high
192+
193+  * fix for the shlibs rc bug (closes: #136196)
194+
195+ -- Kyle McMartin <kyle@debian.org>  Thu, 28 Feb 2002 18:21:40 -0500
196+
197+mad (0.14.2b-1) unstable; urgency=low
198+
199+  * new upstream version
200+  * new maintainer
201+  * new version fixes enum (closes: #129178)
202+  * closing old fixed bug [missing symlink to libmad.so.0] (closes: #119350)
203+
204+ -- Kyle McMartin <kyle@debian.org>  Wed, 16 Jan 2002 22:09:58 -0500
205+
206+mad (0.14.1b-4) unstable; urgency=low
207+
208+  * yet another stupid maintainer mistakes release
209+  * fix the call to dh_makeshlibs, I neglected to add proper
210+    arguments for the new libid3tag0 library (closes: #119146)
211+  * now that the shlibs are sorted out, madplay will have the correct depends
212+    (closes: #119792)
213+
214+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Thu, 15 Nov 2001 22:11:24 -0800
215+
216+mad (0.14.1b-3) unstable; urgency=medium
217+
218+  * duh, id3tag's headers ended up in libmad-dev.  Closes: #118625.
219+
220+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Wed,  7 Nov 2001 13:45:53 -0800
221+
222+mad (0.14.1b-2) unstable; urgency=medium
223+
224+  * Added versioned depends info for piecemeal updaters.  (Closes: #117646)
225+
226+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Wed,  7 Nov 2001 08:10:42 -0800
227+
228+mad (0.14.1b-1) unstable; urgency=low
229+
230+  * reverted package name to libmad0(-dev).  The upstream fixed it's SONAME
231+    issues, yay.
232+  * added libid3tag(-dev), the upstream now supports the installation of this
233+    as a separate entity (closes: #116321)
234+  * -dev packages are now in Section: devel (closes: #116710)
235+  * supports DEB_BUILD_OPTIONS for debug (closes: #104013)
236+
237+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Tue, 23 Oct 2001 11:08:53 -0700
238+
239+mad (0.14.0b-3) unstable; urgency=low
240+
241+  * added a conflicts on libmad0 to the lib and -dev packages, closes: #116581
242+  * updated config.{sub,guess}, closes: #116577
243+
244+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Sun, 21 Oct 2001 16:26:39 -0700
245+
246+mad (0.14.0b-2) unstable; urgency=low
247+
248+  * D'oh, not binary compatible.  The every changing SONAME problem.
249+  * chnaged library package name to match SONAME.  This is horrible because
250+    now I have to change the package name for every release.  However there
251+    is no alternative.  closes: 116305.
252+
253+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Fri, 19 Oct 2001 14:30:29 -0700
254+
255+mad (0.14.0b-1) unstable; urgency=low
256+
257+  * New upstream release
258+  * source now build-depends on zlib
259+
260+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Thu, 18 Oct 2001 21:59:28 -0700
261+
262+mad (0.13.0b-2.1) unstable; urgency=low
263+  * Run libtoolize to get support for new architectures.  Closes: #96616
264+
265+ -- LaMont Jones <lamont@debian.org>  Mon,  9 Jul 2001 21:39:34 -0600
266+
267+mad (0.13.0b-2) unstable; urgency=low
268+
269+  * Now build-depend on gettext (closes: #94964)
270+
271+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Mon, 23 Apr 2001 11:29:21 -0700
272+
273+mad (0.13.0b-1) unstable; urgency=low
274+
275+  * new upstream release
276+  * manpage cleaned up, Closes: #87165
277+
278+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Wed, 11 Apr 2001 18:40:08 -0700
279+
280+mad (0.12.5b-1) unstable; urgency=low
281+
282+  * New upstream, closes: #92825
283+  * updated upstream changelog
284+
285+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Tue,  3 Apr 2001 15:11:05 -0700
286+
287+mad (0.12.4b-1) unstable; urgency=low
288+
289+  * New upstream version
290+
291+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Mon, 12 Feb 2001 14:16:21 -0800
292+
293+mad (0.12.3b-2) unstable; urgency=low
294+
295+  * Oops, wrong section
296+  * left off the Closes: #84103
297+
298+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Thu,  8 Feb 2001 12:17:12 -0800
299+
300+mad (0.12.3b-1) unstable; urgency=low
301+
302+  * New upstream version
303+  * added a madplay package
304+
305+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Wed,  7 Feb 2001 12:04:28 -0800
306+
307+mad (0.11.4b-1) unstable; urgency=low
308+
309+  * New upstream release
310+  * added libmad0 package containing the shared library
311+
312+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Mon,  2 Oct 2000 17:38:01 -0700
313+
314+mad (0.11.0b-0) unstable; urgency=low
315+
316+  * New upstream release
317+
318+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Mon,  5 Jun 2000 14:25:39 -0700
319+
320+mad (0.10.3b-0) unstable; urgency=low
321+
322+  * New upstream release
323+
324+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Thu,  1 Jun 2000 15:05:02 -0700
325+
326+mad (0.10.2b-0) unstable; urgency=low
327+
328+  * Initial Release.
329+
330+ -- Sean 'Shaleh' Perry <shaleh@debian.org>  Tue, 23 May 2000 12:25:00 -0700
331+
332+
333--- libmad-0.15.1b.orig/debian/compat
334+++ libmad-0.15.1b/debian/compat
335@@ -0,0 +1 @@
336+5
337--- libmad-0.15.1b.orig/debian/control
338+++ libmad-0.15.1b/debian/control
339@@ -0,0 +1,33 @@
340+Source: libmad
341+Priority: optional
342+Section: sound
343+Build-Depends: debhelper (>= 8.1.3~), gettext, cdbs (>= 0.4.93~), autotools-dev, quilt, dh-autoreconf
344+Maintainer: Kurt Roeckx <kurt@roeckx.be>
345+Standards-Version: 3.7.3
346+
347+Package: libmad0
348+Architecture: any
349+Multi-Arch: same
350+Section: libs
351+Pre-Depends: ${misc:Pre-Depends}
352+Depends: ${shlibs:Depends}, ${misc:Depends}
353+Description: MPEG audio decoder library
354+ MAD is an MPEG audio decoder. It currently only supports the MPEG 1
355+ standard, but fully implements all three audio layers (Layer I, Layer II,
356+ and Layer III, the latter often colloquially known as MP3.)
357+ .
358+ MAD has the following special features:
359+   - 100% fixed-point (integer) computation
360+   - completely new implementation based on the ISO/IEC 11172-3 standard
361+   - distributed under the terms of the GNU General Public License (GPL)
362+
363+Package: libmad0-dev
364+Architecture: any
365+Section: libdevel
366+Depends: libmad0 (=${binary:Version}), ${misc:Depends}
367+Description: MPEG audio decoder development library
368+ MAD is an MPEG audio decoder. It currently only supports the MPEG 1
369+ standard, but fully implements all three audio layers (Layer I, Layer II,
370+ and Layer III, the latter often colloquially known as MP3.)
371+ .
372+ This is the package you need to develop or compile applications that use MAD.
373--- libmad-0.15.1b.orig/debian/copyright
374+++ libmad-0.15.1b/debian/copyright
375@@ -0,0 +1,26 @@
376+This package was debianized by Sean 'Shaleh' Perry <shaleh@debian.org> on
377+Tue, 23 May 2000 12:25:00 -0700.
378+
379+It was downloaded from http://www.underbit.com/products/mad/
380+
381+Upstream Author: Robert Leslie <rob@mars.org>
382+
383+Copyright (C) 2000-2004 Underbit Technologies, Inc.
384+
385+This program is free software; you can redistribute it and/or modify it
386+under the terms of the GNU General Public License as published by the
387+Free Software Foundation; either version 2, or (at your option) any
388+later version.
389+
390+This program is distributed in the hope that it will be useful,
391+but WITHOUT ANY WARRANTY; without even the implied warranty of
392+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
393+GNU General Public License for more details.
394+
395+You should have received a copy of the GNU General Public License
396+along with this program; if not, write to the Free Software
397+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
398+
399+On Debian GNU/Linux systems, the complete text of the GNU General
400+Public License can be found in `/usr/share/common-licenses/GPL'.
401+
402--- libmad-0.15.1b.orig/debian/libmad0-dev.dirs
403+++ libmad-0.15.1b/debian/libmad0-dev.dirs
404@@ -0,0 +1,2 @@
405+usr/lib
406+usr/include
407--- libmad-0.15.1b.orig/debian/libmad0-dev.docs
408+++ libmad-0.15.1b/debian/libmad0-dev.docs
409@@ -0,0 +1,2 @@
410+CREDITS
411+README
412--- libmad-0.15.1b.orig/debian/libmad0-dev.examples
413+++ libmad-0.15.1b/debian/libmad0-dev.examples
414@@ -0,0 +1 @@
415+minimad.c
416--- libmad-0.15.1b.orig/debian/libmad0-dev.files
417+++ libmad-0.15.1b/debian/libmad0-dev.files
418@@ -0,0 +1,4 @@
419+usr/include/mad.h
420+usr/lib/libmad.a
421+usr/lib/libmad.la
422+usr/lib/libmad.so
423--- libmad-0.15.1b.orig/debian/libmad0-dev.install
424+++ libmad-0.15.1b/debian/libmad0-dev.install
425@@ -0,0 +1,3 @@
426+debian/tmp/usr/include/mad.h /usr/include
427+debian/tmp/usr/lib/*/libmad.a
428+debian/tmp/usr/lib/*/libmad.so
429--- libmad-0.15.1b.orig/debian/libmad0.dirs
430+++ libmad-0.15.1b/debian/libmad0.dirs
431@@ -0,0 +1 @@
432+usr/lib
433--- libmad-0.15.1b.orig/debian/libmad0.docs
434+++ libmad-0.15.1b/debian/libmad0.docs
435@@ -0,0 +1,2 @@
436+CREDITS
437+README
438--- libmad-0.15.1b.orig/debian/libmad0.files
439+++ libmad-0.15.1b/debian/libmad0.files
440@@ -0,0 +1 @@
441+usr/lib/libmad.so.*
442--- libmad-0.15.1b.orig/debian/libmad0.install
443+++ libmad-0.15.1b/debian/libmad0.install
444@@ -0,0 +1 @@
445+debian/tmp/usr/lib/*/libmad.so.*
446--- libmad-0.15.1b.orig/debian/mad.pc
447+++ libmad-0.15.1b/debian/mad.pc
448@@ -0,0 +1,11 @@
449+prefix=/usr
450+exec_prefix=${prefix}
451+libdir=${exec_prefix}/lib
452+includedir=${prefix}/include
453+
454+Name: mad
455+Description: MPEG Audio Decoder
456+Requires:
457+Version: 0.15.0b
458+Libs: -L${libdir} -lmad
459+Cflags: -I${includedir}
460--- libmad-0.15.1b.orig/debian/patches/Provide-Thumb-2-alternative-code-for-MAD_F_MLN.diff
461+++ libmad-0.15.1b/debian/patches/Provide-Thumb-2-alternative-code-for-MAD_F_MLN.diff
462@@ -0,0 +1,34 @@
463+From: Dave Martin
464+Subject: "rsc" doesnt exist anymore in thumb2
465+
466+diff --git a/fixed.h b/fixed.h
467+index 4b58abf..ba4bc26 100644
468+--- a/fixed.h
469++++ b/fixed.h
470+@@ -275,12 +275,25 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
471+ 	 : "+r" (lo), "+r" (hi)  \
472+ 	 : "%r" (x), "r" (y))
473+
474++#ifdef __thumb__
475++/* In Thumb-2, the RSB-immediate instruction is only allowed with a zero
476++	operand.  If needed this code can also support Thumb-1
477++	(simply append "s" to the end of the second two instructions). */
478++#  define MAD_F_MLN(hi, lo)  \
479++    asm ("rsbs        %0, %0, #0\n\t"  \
480++	 "sbc   %1, %1, %1\n\t"  \
481++	 "sub   %1, %1, %2"  \
482++	 : "+&r" (lo), "=&r" (hi)  \
483++	 : "r" (hi)  \
484++	 : "cc")
485++#else /* ! __thumb__ */
486+ #  define MAD_F_MLN(hi, lo)  \
487+     asm ("rsbs	%0, %2, #0\n\t"  \
488+ 	 "rsc	%1, %3, #0"  \
489+-	 : "=r" (lo), "=r" (hi)  \
490++	 : "=&r" (lo), "=r" (hi)  \
491+ 	 : "0" (lo), "1" (hi)  \
492+ 	 : "cc")
493++#endif /* __thumb__ */
494+
495+ #  define mad_f_scale64(hi, lo)  \
496+     ({ mad_fixed_t __result;  \
497--- libmad-0.15.1b.orig/debian/patches/amd64-64bit.diff
498+++ libmad-0.15.1b/debian/patches/amd64-64bit.diff
499@@ -0,0 +1,12 @@
500+Index: libmad-0.15.1b/configure.ac
501+===================================================================
502+--- libmad-0.15.1b.orig/configure.ac	2008-03-07 20:33:05.000000000 +0000
503++++ libmad-0.15.1b/configure.ac	2008-03-07 20:33:31.000000000 +0000
504+@@ -233,6 +233,7 @@
505+ then
506+     case "$host" in
507+ 	i?86-*)     FPM="INTEL"  ;;
508++	x86_64*)    FPM="64BIT"  ;;
509+ 	arm*-*)     FPM="ARM"    ;;
510+ 	mips*-*)    FPM="MIPS"   ;;
511+ 	sparc*-*)   FPM="SPARC"  ;;
512--- libmad-0.15.1b.orig/debian/patches/length-check.patch
513+++ libmad-0.15.1b/debian/patches/length-check.patch
514@@ -0,0 +1,817 @@
515+From: Kurt Roeckx <kurt@roeckx.be>
516+Date: Sun, 28 Jan 2018 19:26:36 +0100
517+Subject: Check the size before reading with mad_bit_read
518+
519+There are various cases where it attemps to read past the end of the buffer
520+using mad_bit_read(). Most functions didn't even know the size of the buffer
521+they were reading from.
522+
523+Index: libmad-0.15.1b/bit.c
524+===================================================================
525+--- libmad-0.15.1b.orig/bit.c
526++++ libmad-0.15.1b/bit.c
527+@@ -138,6 +138,9 @@ unsigned long mad_bit_read(struct mad_bi
528+ {
529+   register unsigned long value;
530+
531++  if (len == 0)
532++    return 0;
533++
534+   if (bitptr->left == CHAR_BIT)
535+     bitptr->cache = *bitptr->byte;
536+
537+Index: libmad-0.15.1b/frame.c
538+===================================================================
539+--- libmad-0.15.1b.orig/frame.c
540++++ libmad-0.15.1b/frame.c
541+@@ -120,11 +120,18 @@ static
542+ int decode_header(struct mad_header *header, struct mad_stream *stream)
543+ {
544+   unsigned int index;
545++  struct mad_bitptr bufend_ptr;
546+
547+   header->flags        = 0;
548+   header->private_bits = 0;
549+
550++  mad_bit_init(&bufend_ptr, stream->bufend);
551++
552+   /* header() */
553++  if (mad_bit_length(&stream->ptr, &bufend_ptr) < 32) {
554++    stream->error = MAD_ERROR_BUFLEN;
555++    return -1;
556++  }
557+
558+   /* syncword */
559+   mad_bit_skip(&stream->ptr, 11);
560+@@ -225,8 +232,13 @@ int decode_header(struct mad_header *hea
561+   /* error_check() */
562+
563+   /* crc_check */
564+-  if (header->flags & MAD_FLAG_PROTECTION)
565++  if (header->flags & MAD_FLAG_PROTECTION) {
566++    if (mad_bit_length(&stream->ptr, &bufend_ptr) < 16) {
567++      stream->error = MAD_ERROR_BUFLEN;
568++      return -1;
569++    }
570+     header->crc_target = mad_bit_read(&stream->ptr, 16);
571++  }
572+
573+   return 0;
574+ }
575+@@ -338,7 +350,7 @@ int mad_header_decode(struct mad_header
576+       stream->error = MAD_ERROR_BUFLEN;
577+       goto fail;
578+     }
579+-    else if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
580++    else if ((end - ptr >= 2) && !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
581+       /* mark point where frame sync word was expected */
582+       stream->this_frame = ptr;
583+       stream->next_frame = ptr + 1;
584+@@ -361,6 +373,8 @@ int mad_header_decode(struct mad_header
585+     ptr = mad_bit_nextbyte(&stream->ptr);
586+   }
587+
588++  stream->error = MAD_ERROR_NONE;
589++
590+   /* begin processing */
591+   stream->this_frame = ptr;
592+   stream->next_frame = ptr + 1;  /* possibly bogus sync word */
593+@@ -413,7 +427,7 @@ int mad_header_decode(struct mad_header
594+     /* check that a valid frame header follows this frame */
595+
596+     ptr = stream->next_frame;
597+-    if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
598++    if ((end - ptr >= 2) && !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
599+       ptr = stream->next_frame = stream->this_frame + 1;
600+       goto sync;
601+     }
602+Index: libmad-0.15.1b/layer12.c
603+===================================================================
604+--- libmad-0.15.1b.orig/layer12.c
605++++ libmad-0.15.1b/layer12.c
606+@@ -72,10 +72,18 @@ mad_fixed_t const linear_table[14] = {
607+  * DESCRIPTION:	decode one requantized Layer I sample from a bitstream
608+  */
609+ static
610+-mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb)
611++mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb, struct mad_stream *stream)
612+ {
613+   mad_fixed_t sample;
614++  struct mad_bitptr frameend_ptr;
615+
616++  mad_bit_init(&frameend_ptr, stream->next_frame);
617++
618++  if (mad_bit_length(ptr, &frameend_ptr) < nb) {
619++    stream->error = MAD_ERROR_LOSTSYNC;
620++    stream->sync = 0;
621++    return 0;
622++  }
623+   sample = mad_bit_read(ptr, nb);
624+
625+   /* invert most significant bit, extend sign, then scale to fixed format */
626+@@ -106,6 +114,10 @@ int mad_layer_I(struct mad_stream *strea
627+   struct mad_header *header = &frame->header;
628+   unsigned int nch, bound, ch, s, sb, nb;
629+   unsigned char allocation[2][32], scalefactor[2][32];
630++  struct mad_bitptr bufend_ptr, frameend_ptr;
631++
632++  mad_bit_init(&bufend_ptr, stream->bufend);
633++  mad_bit_init(&frameend_ptr, stream->next_frame);
634+
635+   nch = MAD_NCHANNELS(header);
636+
637+@@ -118,6 +130,11 @@ int mad_layer_I(struct mad_stream *strea
638+   /* check CRC word */
639+
640+   if (header->flags & MAD_FLAG_PROTECTION) {
641++    if (mad_bit_length(&stream->ptr, &bufend_ptr)
642++		< 4 * (bound * nch + (32 - bound))) {
643++      stream->error = MAD_ERROR_BADCRC;
644++      return -1;
645++    }
646+     header->crc_check =
647+       mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)),
648+ 		  header->crc_check);
649+@@ -133,6 +150,11 @@ int mad_layer_I(struct mad_stream *strea
650+
651+   for (sb = 0; sb < bound; ++sb) {
652+     for (ch = 0; ch < nch; ++ch) {
653++      if (mad_bit_length(&stream->ptr, &frameend_ptr) < 4) {
654++	stream->error = MAD_ERROR_LOSTSYNC;
655++	stream->sync = 0;
656++	return -1;
657++      }
658+       nb = mad_bit_read(&stream->ptr, 4);
659+
660+       if (nb == 15) {
661+@@ -145,6 +167,11 @@ int mad_layer_I(struct mad_stream *strea
662+   }
663+
664+   for (sb = bound; sb < 32; ++sb) {
665++    if (mad_bit_length(&stream->ptr, &frameend_ptr) < 4) {
666++      stream->error = MAD_ERROR_LOSTSYNC;
667++      stream->sync = 0;
668++      return -1;
669++    }
670+     nb = mad_bit_read(&stream->ptr, 4);
671+
672+     if (nb == 15) {
673+@@ -161,6 +188,11 @@ int mad_layer_I(struct mad_stream *strea
674+   for (sb = 0; sb < 32; ++sb) {
675+     for (ch = 0; ch < nch; ++ch) {
676+       if (allocation[ch][sb]) {
677++        if (mad_bit_length(&stream->ptr, &frameend_ptr) < 6) {
678++	  stream->error = MAD_ERROR_LOSTSYNC;
679++	  stream->sync = 0;
680++	  return -1;
681++	}
682+ 	scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6);
683+
684+ # if defined(OPT_STRICT)
685+@@ -185,8 +217,10 @@ int mad_layer_I(struct mad_stream *strea
686+       for (ch = 0; ch < nch; ++ch) {
687+ 	nb = allocation[ch][sb];
688+ 	frame->sbsample[ch][s][sb] = nb ?
689+-	  mad_f_mul(I_sample(&stream->ptr, nb),
690++	  mad_f_mul(I_sample(&stream->ptr, nb, stream),
691+ 		    sf_table[scalefactor[ch][sb]]) : 0;
692++	if (stream->error != 0)
693++	  return -1;
694+       }
695+     }
696+
697+@@ -194,7 +228,14 @@ int mad_layer_I(struct mad_stream *strea
698+       if ((nb = allocation[0][sb])) {
699+ 	mad_fixed_t sample;
700+
701+-	sample = I_sample(&stream->ptr, nb);
702++	if (mad_bit_length(&stream->ptr, &frameend_ptr) < nb) {
703++	  stream->error = MAD_ERROR_LOSTSYNC;
704++	  stream->sync = 0;
705++          return -1;
706++	}
707++	sample = I_sample(&stream->ptr, nb, stream);
708++        if (stream->error != 0)
709++	  return -1;
710+
711+ 	for (ch = 0; ch < nch; ++ch) {
712+ 	  frame->sbsample[ch][s][sb] =
713+@@ -280,13 +321,21 @@ struct quantclass {
714+ static
715+ void II_samples(struct mad_bitptr *ptr,
716+ 		struct quantclass const *quantclass,
717+-		mad_fixed_t output[3])
718++		mad_fixed_t output[3], struct mad_stream *stream)
719+ {
720+   unsigned int nb, s, sample[3];
721++  struct mad_bitptr frameend_ptr;
722++
723++  mad_bit_init(&frameend_ptr, stream->next_frame);
724+
725+   if ((nb = quantclass->group)) {
726+     unsigned int c, nlevels;
727+
728++    if (mad_bit_length(ptr, &frameend_ptr) < quantclass->bits) {
729++      stream->error = MAD_ERROR_LOSTSYNC;
730++      stream->sync = 0;
731++      return;
732++    }
733+     /* degrouping */
734+     c = mad_bit_read(ptr, quantclass->bits);
735+     nlevels = quantclass->nlevels;
736+@@ -299,8 +348,14 @@ void II_samples(struct mad_bitptr *ptr,
737+   else {
738+     nb = quantclass->bits;
739+
740+-    for (s = 0; s < 3; ++s)
741++    for (s = 0; s < 3; ++s) {
742++      if (mad_bit_length(ptr, &frameend_ptr) < nb) {
743++	stream->error = MAD_ERROR_LOSTSYNC;
744++	stream->sync = 0;
745++	return;
746++      }
747+       sample[s] = mad_bit_read(ptr, nb);
748++    }
749+   }
750+
751+   for (s = 0; s < 3; ++s) {
752+@@ -336,6 +391,9 @@ int mad_layer_II(struct mad_stream *stre
753+   unsigned char const *offsets;
754+   unsigned char allocation[2][32], scfsi[2][32], scalefactor[2][32][3];
755+   mad_fixed_t samples[3];
756++  struct mad_bitptr frameend_ptr;
757++
758++  mad_bit_init(&frameend_ptr, stream->next_frame);
759+
760+   nch = MAD_NCHANNELS(header);
761+
762+@@ -402,13 +460,24 @@ int mad_layer_II(struct mad_stream *stre
763+   for (sb = 0; sb < bound; ++sb) {
764+     nbal = bitalloc_table[offsets[sb]].nbal;
765+
766+-    for (ch = 0; ch < nch; ++ch)
767++    for (ch = 0; ch < nch; ++ch) {
768++      if (mad_bit_length(&stream->ptr, &frameend_ptr) < nbal) {
769++	stream->error = MAD_ERROR_LOSTSYNC;
770++	stream->sync = 0;
771++	return -1;
772++      }
773+       allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal);
774++    }
775+   }
776+
777+   for (sb = bound; sb < sblimit; ++sb) {
778+     nbal = bitalloc_table[offsets[sb]].nbal;
779+
780++    if (mad_bit_length(&stream->ptr, &frameend_ptr) < nbal) {
781++      stream->error = MAD_ERROR_LOSTSYNC;
782++      stream->sync = 0;
783++      return -1;
784++    }
785+     allocation[0][sb] =
786+     allocation[1][sb] = mad_bit_read(&stream->ptr, nbal);
787+   }
788+@@ -417,8 +486,14 @@ int mad_layer_II(struct mad_stream *stre
789+
790+   for (sb = 0; sb < sblimit; ++sb) {
791+     for (ch = 0; ch < nch; ++ch) {
792+-      if (allocation[ch][sb])
793++      if (allocation[ch][sb]) {
794++	if (mad_bit_length(&stream->ptr, &frameend_ptr) < 2) {
795++	  stream->error = MAD_ERROR_LOSTSYNC;
796++	  stream->sync = 0;
797++	  return -1;
798++	}
799+ 	scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2);
800++      }
801+     }
802+   }
803+
804+@@ -441,6 +516,11 @@ int mad_layer_II(struct mad_stream *stre
805+   for (sb = 0; sb < sblimit; ++sb) {
806+     for (ch = 0; ch < nch; ++ch) {
807+       if (allocation[ch][sb]) {
808++	if (mad_bit_length(&stream->ptr, &frameend_ptr) < 6) {
809++	  stream->error = MAD_ERROR_LOSTSYNC;
810++	  stream->sync = 0;
811++	  return -1;
812++	}
813+ 	scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6);
814+
815+ 	switch (scfsi[ch][sb]) {
816+@@ -451,11 +531,21 @@ int mad_layer_II(struct mad_stream *stre
817+ 	  break;
818+
819+ 	case 0:
820++	  if (mad_bit_length(&stream->ptr, &frameend_ptr) < 6) {
821++	    stream->error = MAD_ERROR_LOSTSYNC;
822++	    stream->sync = 0;
823++	    return -1;
824++	  }
825+ 	  scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6);
826+ 	  /* fall through */
827+
828+ 	case 1:
829+ 	case 3:
830++	  if (mad_bit_length(&stream->ptr, &frameend_ptr) < 6) {
831++	    stream->error = MAD_ERROR_LOSTSYNC;
832++	    stream->sync = 0;
833++	    return -1;
834++	  }
835+ 	  scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6);
836+ 	}
837+
838+@@ -487,7 +577,9 @@ int mad_layer_II(struct mad_stream *stre
839+ 	if ((index = allocation[ch][sb])) {
840+ 	  index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
841+
842+-	  II_samples(&stream->ptr, &qc_table[index], samples);
843++	  II_samples(&stream->ptr, &qc_table[index], samples, stream);
844++	  if (stream->error != 0)
845++            return -1;
846+
847+ 	  for (s = 0; s < 3; ++s) {
848+ 	    frame->sbsample[ch][3 * gr + s][sb] =
849+@@ -505,7 +597,9 @@ int mad_layer_II(struct mad_stream *stre
850+       if ((index = allocation[0][sb])) {
851+ 	index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
852+
853+-	II_samples(&stream->ptr, &qc_table[index], samples);
854++	II_samples(&stream->ptr, &qc_table[index], samples, stream);
855++	if (stream->error != 0)
856++          return -1;
857+
858+ 	for (ch = 0; ch < nch; ++ch) {
859+ 	  for (s = 0; s < 3; ++s) {
860+Index: libmad-0.15.1b/layer3.c
861+===================================================================
862+--- libmad-0.15.1b.orig/layer3.c
863++++ libmad-0.15.1b/layer3.c
864+@@ -598,7 +598,8 @@ enum mad_error III_sideinfo(struct mad_b
865+ static
866+ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr,
867+ 				  struct channel *channel,
868+-				  struct channel *gr1ch, int mode_extension)
869++				  struct channel *gr1ch, int mode_extension,
870++				  unsigned int bits_left, unsigned int *part2_length)
871+ {
872+   struct mad_bitptr start;
873+   unsigned int scalefac_compress, index, slen[4], part, n, i;
874+@@ -644,8 +645,12 @@ unsigned int III_scalefactors_lsf(struct
875+
876+     n = 0;
877+     for (part = 0; part < 4; ++part) {
878+-      for (i = 0; i < nsfb[part]; ++i)
879++      for (i = 0; i < nsfb[part]; ++i) {
880++	if (bits_left < slen[part])
881++	  return MAD_ERROR_BADSCFSI;
882+ 	channel->scalefac[n++] = mad_bit_read(ptr, slen[part]);
883++	bits_left -= slen[part];
884++      }
885+     }
886+
887+     while (n < 39)
888+@@ -690,7 +695,10 @@ unsigned int III_scalefactors_lsf(struct
889+       max = (1 << slen[part]) - 1;
890+
891+       for (i = 0; i < nsfb[part]; ++i) {
892++	if (bits_left < slen[part])
893++	  return MAD_ERROR_BADSCFSI;
894+ 	is_pos = mad_bit_read(ptr, slen[part]);
895++	bits_left -= slen[part];
896+
897+ 	channel->scalefac[n] = is_pos;
898+ 	gr1ch->scalefac[n++] = (is_pos == max);
899+@@ -703,7 +711,8 @@ unsigned int III_scalefactors_lsf(struct
900+     }
901+   }
902+
903+-  return mad_bit_length(&start, ptr);
904++  *part2_length = mad_bit_length(&start, ptr);
905++  return MAD_ERROR_NONE;
906+ }
907+
908+ /*
909+@@ -712,7 +721,8 @@ unsigned int III_scalefactors_lsf(struct
910+  */
911+ static
912+ unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel,
913+-			      struct channel const *gr0ch, unsigned int scfsi)
914++			      struct channel const *gr0ch, unsigned int scfsi,
915++			      unsigned int bits_left, unsigned int *part2_length)
916+ {
917+   struct mad_bitptr start;
918+   unsigned int slen1, slen2, sfbi;
919+@@ -728,12 +738,20 @@ unsigned int III_scalefactors(struct mad
920+     sfbi = 0;
921+
922+     nsfb = (channel->flags & mixed_block_flag) ? 8 + 3 * 3 : 6 * 3;
923+-    while (nsfb--)
924++    while (nsfb--) {
925++      if (bits_left < slen1)
926++	return MAD_ERROR_BADSCFSI;
927+       channel->scalefac[sfbi++] = mad_bit_read(ptr, slen1);
928++      bits_left -= slen1;
929++    }
930+
931+     nsfb = 6 * 3;
932+-    while (nsfb--)
933++    while (nsfb--) {
934++      if (bits_left < slen2)
935++	return MAD_ERROR_BADSCFSI;
936+       channel->scalefac[sfbi++] = mad_bit_read(ptr, slen2);
937++      bits_left -= slen2;
938++    }
939+
940+     nsfb = 1 * 3;
941+     while (nsfb--)
942+@@ -745,8 +763,12 @@ unsigned int III_scalefactors(struct mad
943+ 	channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
944+     }
945+     else {
946+-      for (sfbi = 0; sfbi < 6; ++sfbi)
947++      for (sfbi = 0; sfbi < 6; ++sfbi) {
948++	if (bits_left < slen1)
949++	  return MAD_ERROR_BADSCFSI;
950+ 	channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
951++	bits_left -= slen1;
952++      }
953+     }
954+
955+     if (scfsi & 0x4) {
956+@@ -754,8 +776,12 @@ unsigned int III_scalefactors(struct mad
957+ 	channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
958+     }
959+     else {
960+-      for (sfbi = 6; sfbi < 11; ++sfbi)
961++      for (sfbi = 6; sfbi < 11; ++sfbi) {
962++	if (bits_left < slen1)
963++	  return MAD_ERROR_BADSCFSI;
964+ 	channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
965++	bits_left -= slen1;
966++      }
967+     }
968+
969+     if (scfsi & 0x2) {
970+@@ -763,8 +789,12 @@ unsigned int III_scalefactors(struct mad
971+ 	channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
972+     }
973+     else {
974+-      for (sfbi = 11; sfbi < 16; ++sfbi)
975++      for (sfbi = 11; sfbi < 16; ++sfbi) {
976++	if (bits_left < slen2)
977++	  return MAD_ERROR_BADSCFSI;
978+ 	channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
979++	bits_left -= slen2;
980++      }
981+     }
982+
983+     if (scfsi & 0x1) {
984+@@ -772,14 +802,19 @@ unsigned int III_scalefactors(struct mad
985+ 	channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
986+     }
987+     else {
988+-      for (sfbi = 16; sfbi < 21; ++sfbi)
989++      for (sfbi = 16; sfbi < 21; ++sfbi) {
990++	if (bits_left < slen2)
991++	  return MAD_ERROR_BADSCFSI;
992+ 	channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
993++	bits_left -= slen2;
994++      }
995+     }
996+
997+     channel->scalefac[21] = 0;
998+   }
999+
1000+-  return mad_bit_length(&start, ptr);
1001++  *part2_length = mad_bit_length(&start, ptr);
1002++  return MAD_ERROR_NONE;
1003+ }
1004+
1005+ /*
1006+@@ -933,19 +968,17 @@ static
1007+ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576],
1008+ 			      struct channel *channel,
1009+ 			      unsigned char const *sfbwidth,
1010+-			      unsigned int part2_length)
1011++			      signed int part3_length)
1012+ {
1013+   signed int exponents[39], exp;
1014+   signed int const *expptr;
1015+   struct mad_bitptr peek;
1016+-  signed int bits_left, cachesz;
1017++  signed int bits_left, cachesz, fakebits;
1018+   register mad_fixed_t *xrptr;
1019+   mad_fixed_t const *sfbound;
1020+   register unsigned long bitcache;
1021+
1022+-  bits_left = (signed) channel->part2_3_length - (signed) part2_length;
1023+-  if (bits_left < 0)
1024+-    return MAD_ERROR_BADPART3LEN;
1025++  bits_left = part3_length;
1026+
1027+   III_exponents(channel, sfbwidth, exponents);
1028+
1029+@@ -956,8 +989,12 @@ enum mad_error III_huffdecode(struct mad
1030+   cachesz  = mad_bit_bitsleft(&peek);
1031+   cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7;
1032+
1033++  if (bits_left < cachesz) {
1034++    cachesz = bits_left;
1035++  }
1036+   bitcache   = mad_bit_read(&peek, cachesz);
1037+   bits_left -= cachesz;
1038++  fakebits = 0;
1039+
1040+   xrptr = &xr[0];
1041+
1042+@@ -986,7 +1023,7 @@ enum mad_error III_huffdecode(struct mad
1043+
1044+     big_values = channel->big_values;
1045+
1046+-    while (big_values-- && cachesz + bits_left > 0) {
1047++    while (big_values-- && cachesz + bits_left - fakebits > 0) {
1048+       union huffpair const *pair;
1049+       unsigned int clumpsz, value;
1050+       register mad_fixed_t requantized;
1051+@@ -1023,10 +1060,19 @@ enum mad_error III_huffdecode(struct mad
1052+ 	unsigned int bits;
1053+
1054+ 	bits       = ((32 - 1 - 21) + (21 - cachesz)) & ~7;
1055++	if (bits_left < bits) {
1056++	  bits = bits_left;
1057++	}
1058+ 	bitcache   = (bitcache << bits) | mad_bit_read(&peek, bits);
1059+ 	cachesz   += bits;
1060+ 	bits_left -= bits;
1061+       }
1062++      if (cachesz < 21) {
1063++	unsigned int bits = 21 - cachesz;
1064++	bitcache <<= bits;
1065++	cachesz += bits;
1066++	fakebits += bits;
1067++      }
1068+
1069+       /* hcod (0..19) */
1070+
1071+@@ -1041,6 +1087,8 @@ enum mad_error III_huffdecode(struct mad
1072+       }
1073+
1074+       cachesz -= pair->value.hlen;
1075++      if (cachesz < fakebits)
1076++	return MAD_ERROR_BADHUFFDATA;
1077+
1078+       if (linbits) {
1079+ 	/* x (0..14) */
1080+@@ -1054,10 +1102,15 @@ enum mad_error III_huffdecode(struct mad
1081+
1082+ 	case 15:
1083+ 	  if (cachesz < linbits + 2) {
1084+-	    bitcache   = (bitcache << 16) | mad_bit_read(&peek, 16);
1085+-	    cachesz   += 16;
1086+-	    bits_left -= 16;
1087++	    unsigned int bits = 16;
1088++	    if (bits_left < 16)
1089++	      bits = bits_left;
1090++	    bitcache   = (bitcache << bits) | mad_bit_read(&peek, bits);
1091++	    cachesz   += bits;
1092++	    bits_left -= bits;
1093+ 	  }
1094++	  if (cachesz - fakebits < linbits)
1095++	    return MAD_ERROR_BADHUFFDATA;
1096+
1097+ 	  value += MASK(bitcache, cachesz, linbits);
1098+ 	  cachesz -= linbits;
1099+@@ -1074,6 +1127,8 @@ enum mad_error III_huffdecode(struct mad
1100+ 	  }
1101+
1102+ 	x_final:
1103++	  if (cachesz - fakebits < 1)
1104++	    return MAD_ERROR_BADHUFFDATA;
1105+ 	  xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
1106+ 	    -requantized : requantized;
1107+ 	}
1108+@@ -1089,10 +1144,15 @@ enum mad_error III_huffdecode(struct mad
1109+
1110+ 	case 15:
1111+ 	  if (cachesz < linbits + 1) {
1112+-	    bitcache   = (bitcache << 16) | mad_bit_read(&peek, 16);
1113+-	    cachesz   += 16;
1114+-	    bits_left -= 16;
1115++	    unsigned int bits = 16;
1116++	    if (bits_left < 16)
1117++	      bits = bits_left;
1118++	    bitcache   = (bitcache << bits) | mad_bit_read(&peek, bits);
1119++	    cachesz   += bits;
1120++	    bits_left -= bits;
1121+ 	  }
1122++	  if (cachesz - fakebits < linbits)
1123++	    return MAD_ERROR_BADHUFFDATA;
1124+
1125+ 	  value += MASK(bitcache, cachesz, linbits);
1126+ 	  cachesz -= linbits;
1127+@@ -1109,6 +1169,8 @@ enum mad_error III_huffdecode(struct mad
1128+ 	  }
1129+
1130+ 	y_final:
1131++	  if (cachesz - fakebits < 1)
1132++	    return MAD_ERROR_BADHUFFDATA;
1133+ 	  xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
1134+ 	    -requantized : requantized;
1135+ 	}
1136+@@ -1128,6 +1190,8 @@ enum mad_error III_huffdecode(struct mad
1137+ 	    requantized = reqcache[value] = III_requantize(value, exp);
1138+ 	  }
1139+
1140++	  if (cachesz - fakebits < 1)
1141++	    return MAD_ERROR_BADHUFFDATA;
1142+ 	  xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
1143+ 	    -requantized : requantized;
1144+ 	}
1145+@@ -1146,6 +1210,8 @@ enum mad_error III_huffdecode(struct mad
1146+ 	    requantized = reqcache[value] = III_requantize(value, exp);
1147+ 	  }
1148+
1149++	  if (cachesz - fakebits < 1)
1150++	    return MAD_ERROR_BADHUFFDATA;
1151+ 	  xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
1152+ 	    -requantized : requantized;
1153+ 	}
1154+@@ -1155,9 +1221,6 @@ enum mad_error III_huffdecode(struct mad
1155+     }
1156+   }
1157+
1158+-  if (cachesz + bits_left < 0)
1159+-    return MAD_ERROR_BADHUFFDATA;  /* big_values overrun */
1160+-
1161+   /* count1 */
1162+   {
1163+     union huffquad const *table;
1164+@@ -1167,15 +1230,24 @@ enum mad_error III_huffdecode(struct mad
1165+
1166+     requantized = III_requantize(1, exp);
1167+
1168+-    while (cachesz + bits_left > 0 && xrptr <= &xr[572]) {
1169++    while (cachesz + bits_left - fakebits > 0 && xrptr <= &xr[572]) {
1170+       union huffquad const *quad;
1171+
1172+       /* hcod (1..6) */
1173+
1174+       if (cachesz < 10) {
1175+-	bitcache   = (bitcache << 16) | mad_bit_read(&peek, 16);
1176+-	cachesz   += 16;
1177+-	bits_left -= 16;
1178++	unsigned int bits = 16;
1179++	if (bits_left < 16)
1180++	  bits = bits_left;
1181++	bitcache   = (bitcache << bits) | mad_bit_read(&peek, bits);
1182++	cachesz   += bits;
1183++	bits_left -= bits;
1184++      }
1185++      if (cachesz < 10) {
1186++	unsigned int bits = 10 - cachesz;
1187++	bitcache <<= bits;
1188++	cachesz += bits;
1189++	fakebits += bits;
1190+       }
1191+
1192+       quad = &table[MASK(bitcache, cachesz, 4)];
1193+@@ -1188,6 +1260,11 @@ enum mad_error III_huffdecode(struct mad
1194+ 		      MASK(bitcache, cachesz, quad->ptr.bits)];
1195+       }
1196+
1197++      if (cachesz - fakebits < quad->value.hlen + quad->value.v
1198++        + quad->value.w + quad->value.x + quad->value.y)
1199++	/* We don't have enough bits to read one more entry, consider them
1200++	 * stuffing bits. */
1201++	break;
1202+       cachesz -= quad->value.hlen;
1203+
1204+       if (xrptr == sfbound) {
1205+@@ -1236,22 +1313,8 @@ enum mad_error III_huffdecode(struct mad
1206+
1207+       xrptr += 2;
1208+     }
1209+-
1210+-    if (cachesz + bits_left < 0) {
1211+-# if 0 && defined(DEBUG)
1212+-      fprintf(stderr, "huffman count1 overrun (%d bits)\n",
1213+-	      -(cachesz + bits_left));
1214+-# endif
1215+-
1216+-      /* technically the bitstream is misformatted, but apparently
1217+-	 some encoders are just a bit sloppy with stuffing bits */
1218+-
1219+-      xrptr -= 4;
1220+-    }
1221+   }
1222+
1223+-  assert(-bits_left <= MAD_BUFFER_GUARD * CHAR_BIT);
1224+-
1225+ # if 0 && defined(DEBUG)
1226+   if (bits_left < 0)
1227+     fprintf(stderr, "read %d bits too many\n", -bits_left);
1228+@@ -2348,10 +2411,11 @@ void III_freqinver(mad_fixed_t sample[18
1229+  */
1230+ static
1231+ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
1232+-			  struct sideinfo *si, unsigned int nch)
1233++			  struct sideinfo *si, unsigned int nch, unsigned int md_len)
1234+ {
1235+   struct mad_header *header = &frame->header;
1236+   unsigned int sfreqi, ngr, gr;
1237++  int bits_left = md_len * CHAR_BIT;
1238+
1239+   {
1240+     unsigned int sfreq;
1241+@@ -2383,6 +2447,7 @@ enum mad_error III_decode(struct mad_bit
1242+     for (ch = 0; ch < nch; ++ch) {
1243+       struct channel *channel = &granule->ch[ch];
1244+       unsigned int part2_length;
1245++      unsigned int part3_length;
1246+
1247+       sfbwidth[ch] = sfbwidth_table[sfreqi].l;
1248+       if (channel->block_type == 2) {
1249+@@ -2391,18 +2456,30 @@ enum mad_error III_decode(struct mad_bit
1250+       }
1251+
1252+       if (header->flags & MAD_FLAG_LSF_EXT) {
1253+-	part2_length = III_scalefactors_lsf(ptr, channel,
1254++	error = III_scalefactors_lsf(ptr, channel,
1255+ 					    ch == 0 ? 0 : &si->gr[1].ch[1],
1256+-					    header->mode_extension);
1257++					    header->mode_extension, bits_left, &part2_length);
1258+       }
1259+       else {
1260+-	part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch],
1261+-					gr == 0 ? 0 : si->scfsi[ch]);
1262++	error = III_scalefactors(ptr, channel, &si->gr[0].ch[ch],
1263++					gr == 0 ? 0 : si->scfsi[ch], bits_left, &part2_length);
1264+       }
1265++      if (error)
1266++        return error;
1267++
1268++      bits_left -= part2_length;
1269+
1270+-      error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length);
1271++      if (part2_length > channel->part2_3_length)
1272++        return MAD_ERROR_BADPART3LEN;
1273++
1274++      part3_length = channel->part2_3_length - part2_length;
1275++      if (part3_length > bits_left)
1276++        return MAD_ERROR_BADPART3LEN;
1277++
1278++      error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part3_length);
1279+       if (error)
1280+ 	return error;
1281++      bits_left -= part3_length;
1282+     }
1283+
1284+     /* joint stereo processing */
1285+@@ -2519,11 +2596,13 @@ int mad_layer_III(struct mad_stream *str
1286+   unsigned int nch, priv_bitlen, next_md_begin = 0;
1287+   unsigned int si_len, data_bitlen, md_len;
1288+   unsigned int frame_space, frame_used, frame_free;
1289+-  struct mad_bitptr ptr;
1290++  struct mad_bitptr ptr, bufend_ptr;
1291+   struct sideinfo si;
1292+   enum mad_error error;
1293+   int result = 0;
1294+
1295++  mad_bit_init(&bufend_ptr, stream->bufend);
1296++
1297+   /* allocate Layer III dynamic structures */
1298+
1299+   if (stream->main_data == 0) {
1300+@@ -2587,14 +2666,15 @@ int mad_layer_III(struct mad_stream *str
1301+     unsigned long header;
1302+
1303+     mad_bit_init(&peek, stream->next_frame);
1304++    if (mad_bit_length(&peek, &bufend_ptr) >= 57) {
1305++      header = mad_bit_read(&peek, 32);
1306++      if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) {
1307++        if (!(header & 0x00010000L))  /* protection_bit */
1308++	  mad_bit_skip(&peek, 16);  /* crc_check */
1309+
1310+-    header = mad_bit_read(&peek, 32);
1311+-    if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) {
1312+-      if (!(header & 0x00010000L))  /* protection_bit */
1313+-	mad_bit_skip(&peek, 16);  /* crc_check */
1314+-
1315+-      next_md_begin =
1316+-	mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8);
1317++        next_md_begin =
1318++	  mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8);
1319++      }
1320+     }
1321+
1322+     mad_bit_finish(&peek);
1323+@@ -2653,7 +2733,7 @@ int mad_layer_III(struct mad_stream *str
1324+   /* decode main_data */
1325+
1326+   if (result == 0) {
1327+-    error = III_decode(&ptr, frame, &si, nch);
1328++    error = III_decode(&ptr, frame, &si, nch, md_len);
1329+     if (error) {
1330+       stream->error = error;
1331+       result = -1;
1332--- libmad-0.15.1b.orig/debian/patches/libmad.thumb.diff
1333+++ libmad-0.15.1b/debian/patches/libmad.thumb.diff
1334@@ -0,0 +1,14 @@
1335+From: Konstantinos Margaritis <markos@debian.org>
1336+Subject: use "adr" instead of "add" to make code ready for thumb2
1337+
1338+--- ./imdct_l_arm.S.orig	2010-02-25 13:25:23.000000000 +0100
1339++++ ./imdct_l_arm.S	2010-02-25 13:27:26.000000000 +0100
1340+@@ -468,7 +468,7 @@
1341+
1342+     @----
1343+
1344+-    add     r2, pc, #(imdct36_long_karray-.-8)  @ r2 = base address of Knn array (PIC safe ?)
1345++    adr     r2, imdct36_long_karray
1346+
1347+
1348+ loop:
1349--- libmad-0.15.1b.orig/debian/patches/md_size.diff
1350+++ libmad-0.15.1b/debian/patches/md_size.diff
1351@@ -0,0 +1,58 @@
1352+From: Kurt Roeckx <kurt@roeckx.be>
1353+Date: Sun, 28 Jan 2018 15:44:08 +0100
1354+Subject: Check the size of the main data
1355+
1356+The main data to decode a frame can come from the current frame and part of the
1357+previous frame, the so called bit reservoir. si.main_data_begin is the part of
1358+the previous frame we need for this frame. frame_space is the amount of main
1359+data that can be in this frame, and next_md_begin is the part of this frame that
1360+is going to be used for the next frame.
1361+
1362+The maximum amount of data from a previous frame that the format allows is 511
1363+bytes. The maximum frame size for the defined bitrates is at MPEG 2.5 layer 2
1364+at 320 kbit/s and 8 kHz sample rate which gives 72 * (320000 / 8000) + 1 = 2881.
1365+So those defines are not large enough:
1366+ # define MAD_BUFFER_GUARD      8
1367+ # define MAD_BUFFER_MDLEN      (511 + 2048 + MAD_BUFFER_GUARD)
1368+
1369+There is also support for a "free" bitrate which allows you to create any frame
1370+size, which can be larger than the buffer.
1371+
1372+Changing the defines is not an option since it's part of the ABI, so we check
1373+that the main data fits in the bufer.
1374+
1375+The previous frame data is stored in *stream->main_data and contains
1376+stream->md_len bytes. If stream->md_len is larger than the data we
1377+need from the previous frame (si.main_data_begin) it still wouldn't fit
1378+in the buffer, so just keep the data that we need.
1379+
1380+Index: libmad-0.15.1b/layer3.c
1381+===================================================================
1382+--- libmad-0.15.1b.orig/layer3.c
1383++++ libmad-0.15.1b/layer3.c
1384+@@ -2608,6 +2608,11 @@ int mad_layer_III(struct mad_stream *str
1385+     next_md_begin = 0;
1386+
1387+   md_len = si.main_data_begin + frame_space - next_md_begin;
1388++  if (md_len + MAD_BUFFER_GUARD > MAD_BUFFER_MDLEN) {
1389++    stream->error = MAD_ERROR_LOSTSYNC;
1390++    stream->sync = 0;
1391++    return -1;
1392++  }
1393+
1394+   frame_used = 0;
1395+
1396+@@ -2625,8 +2630,11 @@ int mad_layer_III(struct mad_stream *str
1397+       }
1398+     }
1399+     else {
1400+-      mad_bit_init(&ptr,
1401+-		   *stream->main_data + stream->md_len - si.main_data_begin);
1402++      memmove(stream->main_data,
1403++	*stream->main_data + stream->md_len - si.main_data_begin,
1404++	si.main_data_begin);
1405++      stream->md_len = si.main_data_begin;
1406++      mad_bit_init(&ptr, *stream->main_data);
1407+
1408+       if (md_len > si.main_data_begin) {
1409+ 	assert(stream->md_len + md_len -
1410--- libmad-0.15.1b.orig/debian/patches/mips-gcc4.4.diff
1411+++ libmad-0.15.1b/debian/patches/mips-gcc4.4.diff
1412@@ -0,0 +1,25 @@
1413+From: Aurelien Jarno <aurelien@aurel32.net>
1414+Subject: Different constraints for mips with gcc-4.4
1415+
1416+This asm constraints has been removed from gcc 4.4, that's why it was not
1417+failing before. See http://gcc.gnu.org/gcc-4.4/changes.html for more
1418+details, including a description of the new way to do it.
1419+
1420+--- libmad-0.15.1b.orig/fixed.h
1421++++ libmad-0.15.1b/fixed.h
1422+@@ -297,6 +297,14 @@
1423+
1424+ /* --- MIPS ---------------------------------------------------------------- */
1425+
1426++# elif defined(FPM_MIPS) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1427++   typedef unsigned int u64_di_t __attribute__ ((mode (DI)));
1428++#  define MAD_F_MLX(hi, lo, x, y) \
1429++   do { \
1430++      u64_di_t __ll = (u64_di_t) (x) * (y); \
1431++      hi = __ll >> 32; \
1432++      lo = __ll; \
1433++   } while (0)
1434+ # elif defined(FPM_MIPS)
1435+
1436+ /*
1437+
1438--- libmad-0.15.1b.orig/debian/patches/optimize.diff
1439+++ libmad-0.15.1b/debian/patches/optimize.diff
1440@@ -0,0 +1,77 @@
1441+Index: libmad-0.15.1b/configure.ac
1442+===================================================================
1443+--- libmad-0.15.1b.orig/configure.ac	2008-03-07 20:31:23.000000000 +0000
1444++++ libmad-0.15.1b/configure.ac	2008-03-07 20:34:26.000000000 +0000
1445+@@ -124,71 +124,7 @@
1446+
1447+ if test "$GCC" = yes
1448+ then
1449+-    if test -z "$arch"
1450+-    then
1451+-	case "$host" in
1452+-	    i386-*)           ;;
1453+-	    i?86-*)           arch="-march=i486" ;;
1454+-	    arm*-empeg-*)     arch="-march=armv4 -mtune=strongarm1100" ;;
1455+-	    armv4*-*)         arch="-march=armv4 -mtune=strongarm" ;;
1456+-	    powerpc-*)        ;;
1457+-	    mips*-agenda-*)   arch="-mcpu=vr4100" ;;
1458+-	    mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;;
1459+-	esac
1460+-    fi
1461+-
1462+-    case "$optimize" in
1463+-	-O|"-O "*)
1464+-	    optimize="-O"
1465+-	    optimize="$optimize -fforce-mem"
1466+-	    optimize="$optimize -fforce-addr"
1467+-	    : #x optimize="$optimize -finline-functions"
1468+-	    : #- optimize="$optimize -fstrength-reduce"
1469+-	    optimize="$optimize -fthread-jumps"
1470+-	    optimize="$optimize -fcse-follow-jumps"
1471+-	    optimize="$optimize -fcse-skip-blocks"
1472+-	    : #x optimize="$optimize -frerun-cse-after-loop"
1473+-	    : #x optimize="$optimize -frerun-loop-opt"
1474+-	    : #x optimize="$optimize -fgcse"
1475+-	    optimize="$optimize -fexpensive-optimizations"
1476+-	    optimize="$optimize -fregmove"
1477+-	    : #* optimize="$optimize -fdelayed-branch"
1478+-	    : #x optimize="$optimize -fschedule-insns"
1479+-	    optimize="$optimize -fschedule-insns2"
1480+-	    : #? optimize="$optimize -ffunction-sections"
1481+-	    : #? optimize="$optimize -fcaller-saves"
1482+-	    : #> optimize="$optimize -funroll-loops"
1483+-	    : #> optimize="$optimize -funroll-all-loops"
1484+-	    : #x optimize="$optimize -fmove-all-movables"
1485+-	    : #x optimize="$optimize -freduce-all-givs"
1486+-	    : #? optimize="$optimize -fstrict-aliasing"
1487+-	    : #* optimize="$optimize -fstructure-noalias"
1488+-
1489+-	    case "$host" in
1490+-		arm*-*)
1491+-		    optimize="$optimize -fstrength-reduce"
1492+-		    ;;
1493+-		mips*-*)
1494+-		    optimize="$optimize -fstrength-reduce"
1495+-		    optimize="$optimize -finline-functions"
1496+-		    ;;
1497+-		i?86-*)
1498+-		    optimize="$optimize -fstrength-reduce"
1499+-		    ;;
1500+-		powerpc-apple-*)
1501+-		    # this triggers an internal compiler error with gcc2
1502+-		    : #optimize="$optimize -fstrength-reduce"
1503+-
1504+-		    # this is really only beneficial with gcc3
1505+-		    : #optimize="$optimize -finline-functions"
1506+-		    ;;
1507+-		*)
1508+-		    # this sometimes provokes bugs in gcc 2.95.2
1509+-		    : #optimize="$optimize -fstrength-reduce"
1510+-		    ;;
1511+-	    esac
1512+-	    ;;
1513+-    esac
1514++    optimize="-O2"
1515+ fi
1516+
1517+ case "$host" in
1518--- libmad-0.15.1b.orig/debian/patches/series
1519+++ libmad-0.15.1b/debian/patches/series
1520@@ -0,0 +1,7 @@
1521+optimize.diff
1522+amd64-64bit.diff
1523+Provide-Thumb-2-alternative-code-for-MAD_F_MLN.diff
1524+libmad.thumb.diff
1525+mips-gcc4.4.diff
1526+md_size.diff
1527+length-check.patch
1528--- libmad-0.15.1b.orig/debian/rules
1529+++ libmad-0.15.1b/debian/rules
1530@@ -0,0 +1,29 @@
1531+#!/usr/bin/make -f
1532+# makefile for libmad
1533+
1534+# Uncomment this to turn on verbose mode.
1535+#export DH_VERBOSE=1
1536+
1537+DEB_DH_MAKESHLIBS_ARGS_libmad0 = -V 'libmad0 (>= 0.15.1b-3)'
1538+
1539+include /usr/share/dpkg/architecture.mk
1540+include /usr/share/cdbs/1/rules/debhelper.mk
1541+include /usr/share/cdbs/1/class/autotools.mk
1542+include /usr/share/cdbs/1/rules/patchsys-quilt.mk
1543+include /usr/share/cdbs/1/rules/autoreconf.mk
1544+
1545+export AUTOMAKE = automake --foreign
1546+
1547+DEB_CONFIGURE_EXTRA_FLAGS=--enable-shared --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)
1548+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
1549+DEB_CONFIGURE_EXTRA_FLAGS += --enable-profiling --enable-debugging
1550+else
1551+DEB_CONFIGURE_EXTRA_FLAGS += --disable-profiling --disable-debugging
1552+endif
1553+
1554+clean::
1555+	# annoying lintian errors
1556+	rm -f config.cache libz/config.log libz/config.status
1557+
1558+install/libmad0-dev::
1559+	install -m644 -D debian/mad.pc debian/libmad0-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/mad.pc
1560--- libmad-0.15.1b.orig/debian/upstream/signing-key.asc
1561+++ libmad-0.15.1b/debian/upstream/signing-key.asc
1562@@ -0,0 +1,84 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XKo9VDdRl6+FM86
1643+5ohMBBgRAgAMBQI+Gm+GBRsMAAAAAAoJECziA2tL84ozR4QAnimS6+3/8iB8Z04Y
1644+wnyIkJ5kSJbTAJ4iI3dIpdAyQuy1qC/Pnv50pTnYqQ==
1645+=60LE
1646+-----END PGP PUBLIC KEY BLOCK-----
1647--- libmad-0.15.1b.orig/debian/watch
1648+++ libmad-0.15.1b/debian/watch
1649@@ -0,0 +1,2 @@
1650+version=3
1651+opts=pgpsigurlmangle==s/$/.sign/ ftp://ftp.mars.org/mpeg/ libmad-(.*)\.tar\.gz
1652