flac.git
3 years agolibFLAC/stream_encoder_intrin_*.c: More refactoring
Erik de Castro Lopo [Wed, 18 Nov 2015 08:24:44 +0000 (19:24 +1100)]
libFLAC/stream_encoder_intrin_*.c: More refactoring

Combine two intrinsic instructions into one line of code.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC/stream_encoder_intrin_*.c: Refactor abs calculation
Erik de Castro Lopo [Wed, 18 Nov 2015 08:23:02 +0000 (19:23 +1100)]
libFLAC/stream_encoder_intrin_*.c: Refactor abs calculation

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC/cpu.c: Whitespace
Erik de Castro Lopo [Wed, 18 Nov 2015 07:59:26 +0000 (18:59 +1100)]
libFLAC/cpu.c: Whitespace

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC: Fix link error
Erik de Castro Lopo [Fri, 6 Nov 2015 20:06:23 +0000 (07:06 +1100)]
libFLAC: Fix link error

The function FLAC__cpu_xgetbv_x86() is declared and defined only
if FLAC__HAS_X86INTRIN is defined. However FLAC__cpu_info() was
calling it even if FLAC__HAS_X86INTRIN was undefined,

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agolibFLAC: Refactoring
Erik de Castro Lopo [Tue, 3 Nov 2015 07:08:49 +0000 (18:08 +1100)]
libFLAC: Refactoring

No functional changes.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoInclude proper headers for sysctlbyname() on Mac OS
Thomas Zander [Thu, 29 Oct 2015 13:32:03 +0000 (14:32 +0100)]
Include proper headers for sysctlbyname() on Mac OS

According to Xcode documentation[1], sysctlbyname is available on
Mac OS via the same includes as on FreeBSD/DragonFly.

[1] https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/sysctlbyname.3.html

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agoMakefile.lite: Include config.mk from top level build dir
Thomas Zander [Thu, 29 Oct 2015 13:22:12 +0000 (14:22 +0100)]
Makefile.lite: Include config.mk from top level build dir

Makefile.lite in libs/executables subdirs must include
top level's config.mk to allow variables defined there (OS, PROC)
to be used; otherwise e.g. EXPLICIT_LIBS is not set and link
fails on Darwin.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agoMake.lite: Proper detection Darwin/x86_64
Thomas Zander [Thu, 29 Oct 2015 13:18:56 +0000 (14:18 +0100)]
Make.lite: Proper detection Darwin/x86_64

- Use uname -m for Darwin/i386 platform
  (uname -p returns i386 on Mac OS)
- Darwin does have sys/param.h; allow correct flac_min/flac_max macro
  expansion

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agoFix manpage: synonyms for encoding options -0 .. -8 now match the code
Thomas Zander [Sun, 25 Oct 2015 12:31:23 +0000 (13:31 +0100)]
Fix manpage: synonyms for encoding options -0 .. -8 now match the code

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agostream_encoder.c: Fix subframe_bps comparison
lvqcl [Sun, 11 Oct 2015 21:59:08 +0000 (00:59 +0300)]
stream_encoder.c: Fix subframe_bps comparison

libFLAC limits the value of qlp_coeff_precision to make sure that
32-bit math is enough for decoding of 16-bit audio.

subframe_bps can be equal to 17 for 16-bit input (for side channel)
so the value of subframe_bps should be compared with 17, not 16.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agolibFLAC/cpu.c: Fix un-initialized variable
Erik de Castro Lopo [Tue, 13 Oct 2015 09:20:29 +0000 (20:20 +1100)]
libFLAC/cpu.c: Fix un-initialized variable

Suggested-by: lvqcl <lvqcl.mail@gmail.com>
3 years agoLet Makefile.lite build succeed on FreeBSD amd64
Thomas Zander [Sun, 11 Oct 2015 15:56:13 +0000 (17:56 +0200)]
Let Makefile.lite build succeed on FreeBSD amd64

- build/config.mk: some OS call x86_64 amd64
- build/config.mk: FreeBSD needs -DHAVE_SYS_PARAM_H in CFLAGS
- build/exe.mk and lib.mk: default compilers on FreeBSD are cc/c++
- src/libFLAC++/Makefile.lite: $(OS) is not defined
- src/libFLAC++/Makefile.lite: Link -lstdc++ on FreeBSD

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agoflac: Error out if decoding RAW with bits != (8|16|24)
Erik de Castro Lopo [Sat, 3 Oct 2015 23:52:23 +0000 (10:52 +1100)]
flac: Error out if decoding RAW with bits != (8|16|24)

Suggested by Christopher Key.

Closes: https://sourceforge.net/p/flac/patches/43/

3 years agotest/ : Use more portable echo constructs
Erik de Castro Lopo [Sat, 3 Oct 2015 22:43:33 +0000 (09:43 +1100)]
test/ : Use more portable echo constructs

Fix suggested by Daniel Macks.

Closes: https://sourceforge.net/p/flac/bugs/433/

3 years agomicrobench: remove duplicate define
Tristan Matthews [Tue, 29 Sep 2015 23:27:49 +0000 (19:27 -0400)]
microbench: remove duplicate define

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agomicrobench: add benchmarking code for Darwin
Tristan Matthews [Tue, 29 Sep 2015 23:27:48 +0000 (19:27 -0400)]
microbench: add benchmarking code for Darwin

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
3 years agolibFLAC: Fix an out-of-bounds heap read
Erik de Castro Lopo [Fri, 25 Sep 2015 22:17:13 +0000 (08:17 +1000)]
libFLAC: Fix an out-of-bounds heap read

When doing a flac to flac conversion, bad data read from the input file
was making it all the way through the encoder to cause a read past the
end of the buffer in the CRC calculation.

Fix had two parts:

* bitwriter.c: Make a debug only assert (assert bits < 32) into a proper
  failure.
* stream_encoder.c: Catch the error condition of wasted bits being greater
  that bits_pers_sample and limit it to the bits_per_sample value.

Found using the American Fuzzy Lop fuzzer.

3 years agosrc/flac/encode.c: Fix undefined behaviour
Erik de Castro Lopo [Mon, 7 Sep 2015 05:55:22 +0000 (15:55 +1000)]
src/flac/encode.c: Fix undefined behaviour

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agotest_flac.sh: Test unsigned as well as signed
Erik de Castro Lopo [Mon, 7 Sep 2015 05:21:47 +0000 (15:21 +1000)]
test_flac.sh: Test unsigned as well as signed

3 years agosrc/test_streams: Generate signed and unsigned RAW files
Erik de Castro Lopo [Mon, 7 Sep 2015 02:30:59 +0000 (12:30 +1000)]
src/test_streams: Generate signed and unsigned RAW files

3 years agotest_streams.sh: Improve error message
Erik de Castro Lopo [Wed, 9 Sep 2015 05:49:11 +0000 (15:49 +1000)]
test_streams.sh: Improve error message

3 years agoflac/decode.c: Fix undefined behaviour
Erik de Castro Lopo [Thu, 3 Sep 2015 14:22:18 +0000 (00:22 +1000)]
flac/decode.c: Fix undefined behaviour

3 years agotest_seeking: Fix undefined behaviour
Erik de Castro Lopo [Thu, 3 Sep 2015 04:51:20 +0000 (14:51 +1000)]
test_seeking: Fix undefined behaviour

3 years agomicrobench/util.c: Win32 support
Erik de Castro Lopo [Wed, 2 Sep 2015 06:34:22 +0000 (16:34 +1000)]
microbench/util.c: Win32 support

3 years agomicrobench/Makefile.am: Fix 'make distcheck'
Erik de Castro Lopo [Wed, 2 Sep 2015 06:33:30 +0000 (16:33 +1000)]
microbench/Makefile.am: Fix 'make distcheck'

3 years agoAdd first micro-benchmark
Erik de Castro Lopo [Mon, 31 Aug 2015 17:38:43 +0000 (03:38 +1000)]
Add first micro-benchmark

3 years agolibFLAC++/metadata.cpp: Fix undefined behaviour
Erik de Castro Lopo [Mon, 31 Aug 2015 14:46:32 +0000 (00:46 +1000)]
libFLAC++/metadata.cpp: Fix undefined behaviour

3 years agoMSVC: Fix libFLAC_static.vcxproj dependencies
Erik de Castro Lopo [Mon, 31 Aug 2015 14:21:34 +0000 (00:21 +1000)]
MSVC: Fix libFLAC_static.vcxproj dependencies

libFLAC_static.vcxproj was missing a dependency on win_utf8_io_static.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

3 years agoflac/encode.c: Fix undefinoed behaviour
Erik de Castro Lopo [Sun, 30 Aug 2015 14:17:03 +0000 (00:17 +1000)]
flac/encode.c: Fix undefinoed behaviour

3 years agolibFLAC/bitwriter.c: Fix undefined behaviour
Erik de Castro Lopo [Sun, 30 Aug 2015 13:54:33 +0000 (23:54 +1000)]
libFLAC/bitwriter.c: Fix undefined behaviour

3 years agolibFLAC/fixed.c: Fix undefined behaviour
Erik de Castro Lopo [Fri, 28 Aug 2015 19:21:43 +0000 (05:21 +1000)]
libFLAC/fixed.c: Fix undefined behaviour

Left shift if a negative integer such that the sign bit is affected is
(according to the C spec) undefined behaviour and the residual
calculations using the shift operator were hitting this.

Fortunately these same calculations using plain multiplication do not
invoke UB and according to benchmarking (on x86_64 linux) have the same
performance as the bit shift version.

3 years agotests: Fix undefined behaviour
Erik de Castro Lopo [Wed, 26 Aug 2015 22:42:23 +0000 (08:42 +1000)]
tests: Fix undefined behaviour

Undefined behaviour in the test support code.

3 years agolibFLAC/format.c: Fix undefined behaviour
Erik de Castro Lopo [Wed, 26 Aug 2015 07:13:39 +0000 (17:13 +1000)]
libFLAC/format.c: Fix undefined behaviour

In the case where seek_table->num_points is zero, seek_table->points
will be NULL and passing that to qsort() invokes undefined behaviour.

Since seek_table->num_points is zero, the only sensible thing to do
is to short circuit return 0.

3 years agolibFLAC/stream_decoder.c: Fix undefined behaviour
Erik de Castro Lopo [Mon, 24 Aug 2015 09:20:35 +0000 (19:20 +1000)]
libFLAC/stream_decoder.c: Fix undefined behaviour

Found by compiling with -fsanitize=undefined and running the testsuite.

3 years agolibFLAC/bitwriter.c: Fix undefined behaviour
Erik de Castro Lopo [Sat, 22 Aug 2015 22:08:27 +0000 (08:08 +1000)]
libFLAC/bitwriter.c: Fix undefined behaviour

Improve folding of signed to unsgned to avoid UB.

3 years agolibFLAC/bitreader.c: Fix undefined behaviour
Erik de Castro Lopo [Sat, 22 Aug 2015 22:05:02 +0000 (08:05 +1000)]
libFLAC/bitreader.c: Fix undefined behaviour

The function FLAC__bitreader_read_raw_int32() triggered undefined behaviour
when sign extending an unsigned value. The Stanford Grahpics bithacks page
provided an alternative that avoided UB.

3 years agolibFLAC/md5.c: Clean up allocation
Erik de Castro Lopo [Sat, 22 Aug 2015 21:37:53 +0000 (07:37 +1000)]
libFLAC/md5.c: Clean up allocation

Make sure ctx->capacity gets updated correctly when safe_realloc()
fails.

Patch-from:  lvqcl <lvqcl.mail@gmail.com>

4 years agolibFLAC: Fix memory leak
Erik de Castro Lopo [Sat, 22 Aug 2015 10:28:44 +0000 (20:28 +1000)]
libFLAC: Fix memory leak

Leak introduced in commit d9ae5e9128. Thanks to lvqcl <lvqcl.mail@gmail.com>
for pointing it out.

4 years agolibFLAC: Add function safe_realloc_()
Erik de Castro Lopo [Sat, 22 Aug 2015 09:22:50 +0000 (19:22 +1000)]
libFLAC: Add function safe_realloc_()

The new function wraps, realloc() and if the realloc() fails, it
free()s the old pointer.

This is an improvement on the potential realloc() memory leak that
was fixed in 15a9062609.

Still needs fuzzing to validate it.

4 years agolibFLAC/stream_decoder: Fix double free
Erik de Castro Lopo [Sat, 22 Aug 2015 06:51:08 +0000 (16:51 +1000)]
libFLAC/stream_decoder: Fix double free

The american-fuzzy-lop fuzzer found a couple of instances of double
free() resulting from commit 15a9062609.

The problematic free() were the ones associated with use of the
safe_realloc_mul_2op_() function which can call realloc(ptr,0) which
according to the realloc manpage is already an implicit free().

4 years agometaflac: add --scan-replay-gain option
Ben Boeckel [Thu, 13 Aug 2015 01:45:04 +0000 (21:45 -0400)]
metaflac: add --scan-replay-gain option

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
4 years agolibFLAC: Fix potential meory leaks
Erik de Castro Lopo [Sun, 9 Aug 2015 04:31:57 +0000 (14:31 +1000)]
libFLAC: Fix potential meory leaks

If the `realloc` function failed, memory would leak.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agodecoder: Treat negative qlp_shift as an error
Erik de Castro Lopo [Sat, 8 Aug 2015 22:50:30 +0000 (08:50 +1000)]
decoder: Treat negative qlp_shift as an error

Shift by a negative value is undefined behaviour so there is no "right"
way of dealing with this.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agoWindows: Ensure FreeLibrary() calls match LoadLibrary() calls
Erik de Castro Lopo [Sat, 8 Aug 2015 22:45:44 +0000 (08:45 +1000)]
Windows: Ensure FreeLibrary() calls match LoadLibrary() calls

The function get_utf8_argv() was calling LoadLibrary to load msvcrt.dll
but wasn't calling FreeLibrary() if GetProcAddress() fails.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agoflac/metaflac: Do case-insensitve comparison of hex values
Erik de Castro Lopo [Sat, 8 Aug 2015 22:43:29 +0000 (08:43 +1000)]
flac/metaflac: Do case-insensitve comparison of hex values

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agoCompat: Fix for MSVC deprecated functions
Erik de Castro Lopo [Sat, 8 Aug 2015 22:41:27 +0000 (08:41 +1000)]
Compat: Fix for MSVC deprecated functions

According to MSDN, stricmp and strnicmp functions are deprecated
since MSVC 2005 and _stricmp/_strnicmp should be used instead.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agoautogen.sh: Add --no-symlinks option
Erik de Castro Lopo [Sat, 1 Aug 2015 07:54:49 +0000 (17:54 +1000)]
autogen.sh: Add --no-symlinks option

4 years agoautogen.sh: Switch from bash to sh and make it POSIX
Erik de Castro Lopo [Sat, 1 Aug 2015 07:47:06 +0000 (17:47 +1000)]
autogen.sh: Switch from bash to sh and make it POSIX

4 years agolibFLAC: Fix decoder_flush with uninitialized decoder
Erik de Castro Lopo [Mon, 13 Jul 2015 12:15:58 +0000 (22:15 +1000)]
libFLAC: Fix decoder_flush with uninitialized decoder

Closes: https://sourceforge.net/p/flac/bugs/428

4 years agolibFLAC/cpu.c: Assume Android has SSE
Erik de Castro Lopo [Sun, 12 Jul 2015 02:08:18 +0000 (12:08 +1000)]
libFLAC/cpu.c: Assume Android has SSE

According to https://developer.android.com/ndk/guides/abis.html#x86
Android always support SSE, so there's no need to test SSE OS support.

Why both __ANDROID__ and ANDROID are tested:
http://stackoverflow.com/questions/15328751/android-macro-suddenly-not-defined
http://stackoverflow.com/questions/6374523/how-to-detect-compilation-by-android-ndk-in-a-c-c-file
https://groups.google.com/forum/#!topic/android-ndk/cf9_f1SLXls

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agoflac/foreign_metadata: Fix for odd RIFF chunk size
Erik de Castro Lopo [Fri, 10 Jul 2015 09:20:24 +0000 (19:20 +1000)]
flac/foreign_metadata: Fix for odd RIFF chunk size

Accept odd values to ckSize of RIFF chunk. FLAC should read these
but should avoid creating them.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
Closes: https://sourceforge.net/p/flac/support-requests/152/
Closes: https://sourceforge.net/p/flac/bugs/419/

4 years agoconfigure.ac : Pass -fno-inline-small-functions when using GCC 4.7
Mario Sanchez Prada [Mon, 8 Jun 2015 16:25:27 +0000 (17:25 +0100)]
configure.ac : Pass -fno-inline-small-functions when using GCC 4.7

For some reason, the build fails when using GCC 4.7 due to the implicit
-finline-functions option passed to the compiler when -O3 is enabled,
which does not happen in newer versions of GCC, probably due to some of
the "General Optimizer Improvements" included in 4.8 (see [1]).

Fortunately, we don't need to disable -finline-functions completely but
just do it for "small functions", which is what this patch does.

[1] https://gcc.gnu.org/gcc-4.8/changes.html

Closes: https://sourceforge.net/p/flac/bugs/429/
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
4 years agolibFLAC/metadata_object.c: Assign NULL after free()
Erik de Castro Lopo [Mon, 6 Jul 2015 11:30:55 +0000 (21:30 +1000)]
libFLAC/metadata_object.c: Assign NULL after free()

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agolibFLAC/md5.c: Minor formatting fixes
Erik de Castro Lopo [Mon, 6 Jul 2015 11:29:36 +0000 (21:29 +1000)]
libFLAC/md5.c: Minor formatting fixes

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agolibFLAC: More comment validation
Erik de Castro Lopo [Sun, 5 Jul 2015 11:21:44 +0000 (21:21 +1000)]
libFLAC: More comment validation

When the allocation for obj->comment fails, set obj->num_comments
to zero.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agoMakefile.am: Remove old cruft
Erik de Castro Lopo [Sun, 5 Jul 2015 10:59:15 +0000 (20:59 +1000)]
Makefile.am: Remove old cruft

4 years agolibFLAC: Improve fix in bc5113007a
Erik de Castro Lopo [Sun, 5 Jul 2015 10:54:28 +0000 (20:54 +1000)]
libFLAC: Improve fix in bc5113007a

The assert that was removed in bc5113007a, was a result of error
handling in read_metadata_vorbiscomment_() which set obj->num_comments
to zero, without freeing obj->comments and setting it to NULL.

This commit also restores the assert that was removed.

4 years agolibFLAC: Remove un-needed assert
Erik de Castro Lopo [Sat, 4 Jul 2015 06:27:21 +0000 (16:27 +1000)]
libFLAC: Remove un-needed assert

This asset was firing when the build was configured with --enable-debug
and the flac executable was then run under American Fuzzy Lop. Removing
the assert did not cause any other problems, even under AFL.

4 years agoreplaygain: Remove dead assignment
Erik de Castro Lopo [Sat, 4 Jul 2015 02:34:57 +0000 (12:34 +1000)]
replaygain: Remove dead assignment

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agolibFLAC: Remove un-needed test for NULL before free
Erik de Castro Lopo [Sat, 4 Jul 2015 02:19:29 +0000 (12:19 +1000)]
libFLAC: Remove un-needed test for NULL before free

Passing a NULL pointer to free() is a no-op.

4 years agoflac: Fix inlining failure warning
Erik de Castro Lopo [Sat, 4 Jul 2015 01:51:22 +0000 (11:51 +1000)]
flac: Fix inlining failure warning

Also remove related, but old and irrelevant comment.

4 years agograbbag: Replace strncpy with safe_strncpy
Erik de Castro Lopo [Fri, 3 Jul 2015 23:15:24 +0000 (09:15 +1000)]
grabbag: Replace strncpy with safe_strncpy

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agoRemove old incorrect comment
Erik de Castro Lopo [Fri, 24 Apr 2015 22:16:27 +0000 (08:16 +1000)]
Remove old incorrect comment

As discussed on the flac-dev mailing list.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agoconfigure: Only use -mstackrealign on i686 for mingw32/os2
Tristan Matthews [Sat, 11 Apr 2015 05:05:30 +0000 (01:05 -0400)]
configure: Only use -mstackrealign on i686 for mingw32/os2

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
4 years agoconfigure.ac : Add -mstackrealign whenever we add -msse2.
Erik de Castro Lopo [Tue, 31 Mar 2015 07:21:38 +0000 (18:21 +1100)]
configure.ac : Add -mstackrealign whenever we add -msse2.

There have been some (pretty much unconfirmed) reports of problems
with SSE enabled but without this stack alignment flag.

4 years agosrc/libFLAC/lpc.c : Restore missing conditional.
Erik de Castro Lopo [Tue, 31 Mar 2015 07:08:09 +0000 (18:08 +1100)]
src/libFLAC/lpc.c : Restore missing conditional.

Git commit 9c2290ade5 in-correctly removed a conditional around
an fprintf. Thanks to mark4o on #xiph (freenode) for reporting
this.

4 years agoconfigure.ac : Tweak for x32 architecture.
Erik de Castro Lopo [Wed, 11 Mar 2015 09:51:42 +0000 (20:51 +1100)]
configure.ac : Tweak for x32 architecture.

The x32 architecture uses and ILP32 (32 bit ints, longs and pointers)
on an x86_64 CPU. Since the CPU is x86_64 we need to set FLAC__CPU_X86_64
even though the pointer size is 32 bits.

Patch-from: Stuart Shelton
Closes: https://sourceforge.net/p/flac/bugs/427/

4 years agoconfigure.ac : Fix FLAC__HAS_X86INTRIN / FLaC__SSE_OS.
Erik de Castro Lopo [Tue, 24 Feb 2015 19:40:53 +0000 (06:40 +1100)]
configure.ac : Fix FLAC__HAS_X86INTRIN / FLaC__SSE_OS.

* Correct definition of FLAC__HAS_X86INTRIN in config.h file.
* Correct comparison of sse_os with 'true' instead of 'yes'.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agosrc/test_streams/main.c : Use flac_snprintf() instead of snprintf().
Erik de Castro Lopo [Tue, 24 Feb 2015 19:38:04 +0000 (06:38 +1100)]
src/test_streams/main.c : Use flac_snprintf() instead of snprintf().

MSVC doesn't have snprintf().

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agoci/flac-autotool.sh : Test 'distcheck' target instead of 'check'.
Erik de Castro Lopo [Tue, 24 Feb 2015 07:14:12 +0000 (18:14 +1100)]
ci/flac-autotool.sh : Test 'distcheck' target instead of 'check'.

4 years agotest/test_flac.sh : Make it work for 'make distcheck'.
Erik de Castro Lopo [Tue, 24 Feb 2015 07:04:44 +0000 (18:04 +1100)]
test/test_flac.sh : Make it work for 'make distcheck'.

An output file was being set to read only and hence could not be
overwritten by a later test. Not sure why this only affected the
'make distcheck' target.

4 years agoFix cursheet tests for 'make distcheck'.
Erik de Castro Lopo [Mon, 23 Feb 2015 08:42:30 +0000 (19:42 +1100)]
Fix cursheet tests for 'make distcheck'.

4 years agosrc/encode.c : Fix potential infinite loop in flac-toflac encoding.
Erik de Castro Lopo [Sun, 22 Feb 2015 07:05:12 +0000 (18:05 +1100)]
src/encode.c : Fix potential infinite loop in flac-toflac encoding.

A malformed file (generated by AFL) had a 'samples_left_to_process' value
of greater than the actual numbe of samples. When re-encoding the decoder
would get to the end of the file and then continuously return a decode
status of FLAC__STREAM_DECODER_END_OF_STREAM, causing an infinite loop.

Solution is to break out of the loop on two consecutive end-of-stream
events.

4 years agoAdd file ci/flac-autotool.sh.
Erik de Castro Lopo [Fri, 20 Feb 2015 21:47:41 +0000 (08:47 +1100)]
Add file ci/flac-autotool.sh.

Currently only does 'make check' because 'make distcheck' is currently
broken.

4 years agolibFLAC/metadata_object.c : Fix typo in comment.
Erik de Castro Lopo [Fri, 20 Feb 2015 20:05:21 +0000 (07:05 +1100)]
libFLAC/metadata_object.c : Fix typo in comment.

4 years agoconfigure.ac : Detect 'amd64' as being same as 'x86_64'.
Christian Weisgerber [Fri, 9 Jan 2015 22:37:37 +0000 (22:37 +0000)]
configure.ac : Detect 'amd64' as being same as 'x86_64'.

On BSD systems, the 64-bit x86 architecture is called "amd64".

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
4 years agosrc/libFLAC/stream_decoder.c : Rework fix for seeking bug.
Miroslav Lichvar [Mon, 15 Dec 2014 14:46:12 +0000 (15:46 +0100)]
src/libFLAC/stream_decoder.c : Rework fix for seeking bug.

To avoid crash caused by an unbound LPC decoding when predictor order is
larger than blocksize, the sanity check needs to be moved to the subframe
decoding functions.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
4 years agolibFLAC : Put upper bound on number of seek points.
Erik de Castro Lopo [Wed, 18 Feb 2015 06:55:52 +0000 (17:55 +1100)]
libFLAC : Put upper bound on number of seek points.

Restrict number of seek points to 32768 total and a maximum of two per
second.

Ten hours of content is 36000 seconds which gives about one seek point
for every second for those ten hours. Also, having more than two seek
point per second makes little sense regardless of content length.

Without these restrictions flac-to-flac encoding of a malformed input
file (eg something generated with http://lcamtuf.coredump.cx/afl/)
can result in an attempt to generate a stupidly large number of seek
points and cause an allocation failure.

4 years agoflac : Fix for https://sourceforge.net/p/flac/bugs/425/
Erik de Castro Lopo [Tue, 17 Feb 2015 07:35:05 +0000 (18:35 +1100)]
flac : Fix for https://sourceforge.net/p/flac/bugs/425/

* flac/encode.c : Validate num_tracks field of cuesheet.
* libFLAC/stream_encoder.c : Add check for a NULL pointer.
* flac/encode.c : Improve bounds checking.

Closes: https://sourceforge.net/p/flac/bugs/425/

4 years agotest/test_metaflac.sh : Out-of-tree build fixes.
Erik de Castro Lopo [Sun, 15 Feb 2015 06:02:14 +0000 (17:02 +1100)]
test/test_metaflac.sh : Out-of-tree build fixes.

4 years agotest/test_flac.sh : Out-of-tree build fixes.
Erik de Castro Lopo [Sun, 15 Feb 2015 05:32:25 +0000 (16:32 +1100)]
test/test_flac.sh : Out-of-tree build fixes.

4 years agoUpdate grabbag tests to work out-of-tree.
Erik de Castro Lopo [Sun, 15 Feb 2015 03:31:30 +0000 (14:31 +1100)]
Update grabbag tests to work out-of-tree.

4 years agotest/test_flac.sh : Silence increased encoding size warnings.
Erik de Castro Lopo [Fri, 13 Feb 2015 08:47:30 +0000 (19:47 +1100)]
test/test_flac.sh : Silence increased encoding size warnings.

These warning are supposed to occur for files with noise-like
characteristics and some of the tests use files containing noise.

4 years agotest/Makefile.am : Collapse 'fullcheck' into 'check' target.
Erik de Castro Lopo [Sat, 27 Dec 2014 01:30:41 +0000 (12:30 +1100)]
test/Makefile.am : Collapse 'fullcheck' into 'check' target.

4 years agotest/common.sh.in : Add top_builddir and top_srcdir variables.
Erik de Castro Lopo [Sun, 21 Dec 2014 03:41:59 +0000 (14:41 +1100)]
test/common.sh.in : Add top_builddir and top_srcdir variables.

These are needed for running some of the tests when building out
of tree.

4 years agoreplaygain test: Use C code to generate test files.
Erik de Castro Lopo [Sat, 20 Dec 2014 03:24:41 +0000 (14:24 +1100)]
replaygain test: Use C code to generate test files.

4 years agosrc/test_streams/ : Pull out write_simple_wavex_header() for reuse.
Erik de Castro Lopo [Fri, 19 Dec 2014 09:35:37 +0000 (20:35 +1100)]
src/test_streams/ : Pull out write_simple_wavex_header() for reuse.

4 years agotest/test_replaygain.sh : Minor cleanup.
Erik de Castro Lopo [Sat, 20 Dec 2014 00:40:41 +0000 (11:40 +1100)]
test/test_replaygain.sh : Minor cleanup.

* Pipe un-needed strerr output to /dev/null.
* Pass --silent and --no-seektable to the flac executable.
* When generating tones, use --output-name=....

4 years agosrc/libFLAC/stream_decoder.c : Fix NULL de-reference.
Erik de Castro Lopo [Wed, 17 Dec 2014 08:02:26 +0000 (19:02 +1100)]
src/libFLAC/stream_decoder.c : Fix NULL de-reference.

NULL de-reference can really only happen on a malformed file.
Found using afl (http://lcamtuf.coredump.cx/afl/).

4 years agosrc/flac/decode.c : Add WAVEFORMATEXTENSIBLE to WAV files as needed.
Erik de Castro Lopo [Sun, 14 Dec 2014 09:00:33 +0000 (20:00 +1100)]
src/flac/decode.c : Add WAVEFORMATEXTENSIBLE to WAV files as needed.

Patch-by: lvqcl <lvqcl.mail@gmail.com>
4 years agoGrammatical error in make file comment fixed
Karthik Periagaram [Sat, 13 Dec 2014 21:15:52 +0000 (13:15 -0800)]
Grammatical error in make file comment fixed

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
4 years agoSpelling and grammar fixes for console output
Karthik Periagaram [Sat, 13 Dec 2014 21:12:02 +0000 (13:12 -0800)]
Spelling and grammar fixes for console output

This commit fixes a typo in a console debug message encountered during
encoding. It also fixes a grammatical error in the same message.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
4 years agostream_decoder.c : Fix free-ing of unitilialized pointer.
Erik de Castro Lopo [Thu, 11 Dec 2014 09:40:37 +0000 (20:40 +1100)]
stream_decoder.c : Fix free-ing of unitilialized pointer.

Found using afl (http://lcamtuf.coredump.cx/afl/).

4 years agosrc/libFLAC/stream_decoder.c : Fix seek bug.
Erik de Castro Lopo [Wed, 10 Dec 2014 07:54:16 +0000 (18:54 +1100)]
src/libFLAC/stream_decoder.c : Fix seek bug.

Janne Hyvärinen reported a problem with seeking as a result of the
fix for CVE-2014-9028. This is a different solution to the issue
that should not adversely affect seeking.

This version of the fix for the above CVE has been extensively fuzz
tested using afl (http://lcamtuf.coredump.cx/afl/).

Reported-by: Janne Hyvärinen <cse@sci.fi>
4 years agoflac/vorbiscomment.c : Fix typo.
Erik de Castro Lopo [Mon, 8 Dec 2014 19:04:40 +0000 (06:04 +1100)]
flac/vorbiscomment.c : Fix typo.

Patch-from: Jan Stary <hans@stare.cz>

4 years agoRemove traiing whitespace (mostly .c and .h files).
Erik de Castro Lopo [Thu, 4 Dec 2014 18:52:25 +0000 (05:52 +1100)]
Remove traiing whitespace (mostly .c and .h files).

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agoImprove LPC order guess
Martijn van Beurden [Wed, 3 Dec 2014 13:59:19 +0000 (14:59 +0100)]
Improve LPC order guess

The recent compression preset retuning improved upon most material
but it the few tracks that show regression are usually classical
music. This patch improves compression by improving the LPC order
guess, of which classical music benefits most.

Improvement is 0.007% on average but up to 0.1%. I haven't seen
regressions for any of my test samples.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
4 years agoImprove encoding speed on older Intel CPUs.
Erik de Castro Lopo [Thu, 4 Dec 2014 10:03:01 +0000 (21:03 +1100)]
Improve encoding speed on older Intel CPUs.

The commit http://git.xiph.org/?p=flac.git;a=commit;h=e9d805dd4374
changed the that calculate autocorrelation. However, the new code
worked slightly (about 4%) slower on Core 2, but with the new
presets the speed decrease can reach ~25%.

This patch enables both old and new functions and chooses between
them at runtime.

Patch-from: lvqcl <lvqcl.mail@gmail.com>

4 years agosrc/flac/main.c : Fix an output line > 81 characters in length.
Erik de Castro Lopo [Thu, 4 Dec 2014 10:01:19 +0000 (21:01 +1100)]
src/flac/main.c : Fix an output line > 81 characters in length.

Requested-by: lvqcl <lvqcl.mail@gmail.com>
4 years agoFix some minor word duplication
Zoë Blade [Mon, 1 Dec 2014 14:38:11 +0000 (14:38 +0000)]
Fix some minor word duplication

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>