Commit Graph

165 Commits

Author SHA1 Message Date
Erik de Castro Lopo
187e596e4c stream_encoder.c : Improve fix for arithmetic overflow.
Only use the 32 bit accumulator if the input data is 16 bits or less.
2013-08-02 06:21:02 +10:00
Erik de Castro Lopo
f34f31dac0 stream_encoder.c : Improve fix for arithmetic overflow.
The previous fix (patch 6f7ec60c) had the undesireable effect of slowing
down encoding speed on 16 bit files where the arithmetic overflow was
less likely to happen.

This fix forces the use of a FLAC__uint64 accumulator for 24 bit files
and restores the use of a FLAC_uint32 accumulator for 16 (and less) bit
files.

Unfortunately, I have not been able to prove to myself that this overflow
*cannot* happen with 16 bit files.
2013-07-21 21:05:31 +10:00
Erik de Castro Lopo
6f7ec60c7e stream_encoder.c : Fix an arithmetic overflow in the RICE2 partitioner.
For a specific 24 bit WAV file provided by Leigh Dyer

    http://lists.xiph.org/pipermail/flac-dev/2013-July/004284.html

encoding with compression level 7 was generating a file a couple of
orders of magintude larger than the original.

Debugging showed that variable abs_residual_partition_sum (a FLAC__uint32)
in function precompute_partition_info_sums_() was suffering from an
arithmetic overflowing on some 24 bit input files although this value
overflowing did not always cause larger output files.

Since the value abs_residual_partition_sum is eventually stored in an
array of FLAC__uint64, it makes sense to make abs_residual_partition_sum
a FLAC__uint64 anyway.

Debugging this problem was made easier by use of the Clang compiler's
-fsanitize=integer option.
2013-07-17 19:42:12 +10:00
Erik de Castro Lopo
b1982fbc5f Set version to 1.3.0 and update coyprights throughout. 2013-05-26 19:17:53 +10:00
Erik de Castro Lopo
b9574fe589 Fix a bunch of compiler warnings (mainly MinGW). 2013-04-07 13:44:45 +10:00
Erik de Castro Lopo
5705b4d7b2 Huge Windows utf8 I/O patch.
Patch from Janne Hyvärinen <cse@sci.fi>.
2013-03-29 21:25:59 +11:00
Erik de Castro Lopo
f25b2602dc Fix a couple of Windows 2Gig file size issues.
Patch submitted by Janne Hyvärinen <cse@sci.fi>.
2013-03-14 18:22:37 +11:00
Erik de Castro Lopo
96a5ba7120 Fix -Wshadow warnings. 2013-03-11 06:06:34 +11:00
Erik de Castro Lopo
dd1fa80883 Fix -Wstrict-prototypes -Wmissing-prototypes warnings.
The files src/flac/encode.c and src/libFLAC/stream_encoder.c use
functions in libFLAC that are marked as 'unpublished debug routines'.
This patch moves these functions to new file include/share/private.h
and marks them as 'unpublished debug routines'.
2013-03-11 06:06:33 +11:00
Erik de Castro Lopo
70be52b1dd src/libFLAC/stream_encoder.c : Fix typo.
FLAC__treamEncoderReadStatusString -> FLAC__StreamEncoderReadStatusString

Thanks to nu774 on github.
2012-11-30 15:33:59 +11:00
Erik de Castro Lopo
a7e3705d05 Move code inside #ifdef _MSC_VER to compat.h. 2012-06-22 16:03:04 +10:00
Erik de Castro Lopo
8749dc278d Fix building when configured with --disable-shared.
The problem was that the function safe_malloc_mul_2op_() was originally
defined as static inline in inclide/share/alloc.h but had to be moved
because GCC was refusing to inline it. Once moved however, static linking
would fail when building the flac executable because the function ended
up beiong linked twice.
2012-06-22 14:23:56 +10:00
Erik de Castro Lopo
feab11e9bd Fix FLAC__stream_decoder_delete() and FLAC__stream_encoder_delete()
so that they will simply return if passed a NULL pointer (ie just
like the C free() stdlib function).
2012-06-22 13:39:40 +10:00
Cristian Rodríguez
9b7cb22f84 Update and improve autotools build
- INCLUDES is deprecated, and CPPFLAGS is an user-defined
  variable, use the proper AM_CPPFLAGS instead

- Remove FLAC__INLINE definition, providing proper
  replacement for MSVC compilers.

- Detect if we have C99 's lround and provide a replacement
  for windows...
2012-04-08 09:03:03 +10:00
Cristian Rodríguez
f029625591 V2: Use a single definition of MIN and MAX in sources 2012-04-06 09:52:06 +10:00
Erik de Castro Lopo
6c2040dc90 Remove casting of return value from *alloc() functions. 2012-04-04 21:29:25 +10:00
Erik de Castro Lopo
59afe36f71 Add file include/share/compat.h and start moving CPP hackery into it. 2012-02-04 16:13:37 +11:00
Erik de Castro Lopo
6c7568b712 Patch from JonY to suppress redefinition warnings with mingw-w64 lfs64 warnings. 2012-02-04 15:31:28 +11:00
Erik de Castro Lopo
3b41451197 Fix memory leak when reinitializing stream encoder.
http://sourceforge.net/tracker/?func=detail&aid=3390048&group_id=13478&atid=313478
2012-02-01 22:01:05 +11:00
Josh Coalson
dea0f5a044 add 2009 copyright 2009-01-07 07:31:28 +00:00
Josh Coalson
a832ef32fb fixes for windows builds (SF#1676822: https://sourceforge.net/tracker2/?func=detail&aid=1676822&group_id=13478&atid=113478) 2009-01-02 01:12:59 +00:00
Josh Coalson
d8a6f4aaf7 fix problem with encoder being too strict about subset blocksizes 2008-05-27 05:20:15 +00:00
Josh Coalson
82b128050e update copyright for 2008 2008-02-28 05:34:21 +00:00
Josh Coalson
504dcafeb4 minor comments 2007-09-13 15:42:47 +00:00
Josh Coalson
0f008d2e9e extra checking on memory allocation sizes to prevent a class of overflow attacks 2007-09-11 04:49:56 +00:00
Josh Coalson
05f710f4e0 add support for RESIDUAL_CODING_METHOD_PARTITIONED_RICE2 and blocking strategy bit 2007-07-31 00:51:26 +00:00
Josh Coalson
f395ec43cf fix for FLAC__INTEGER_ONLY_LIBRARY 2007-06-20 01:23:02 +00:00
Josh Coalson
e70895b984 minor comments 2007-06-19 23:59:16 +00:00
Josh Coalson
00da5ae8ec add internal FLAC__stream_encoder_set/get_do_md5() 2007-06-14 05:19:46 +00:00
Josh Coalson
0429d6089a call precompute_partition_info_sums_32bit_asm_ia32_() on x86 if available 2007-04-04 01:08:24 +00:00
Josh Coalson
a0206629d3 MSVC optimization in process calls 2007-04-04 01:07:40 +00:00
Josh Coalson
dca2d1a1d5 remove more redundant logic in process calls 2007-04-04 01:06:08 +00:00
Josh Coalson
4a040f6b8a window the integer_signal instead of real_signal, remove unused real_signal from datapath 2007-04-04 00:59:28 +00:00
Josh Coalson
0a0a10f358 minor optimizations to precompute_partition_info_sums_() 2007-03-31 01:01:02 +00:00
Josh Coalson
2258fa8ec9 add FLAC__format_sample_rate_is_subset() 2007-03-30 01:02:40 +00:00
Josh Coalson
099a2893da minor tweaks to private md5 interface 2007-03-14 07:58:19 +00:00
Josh Coalson
14b184cced unify inlining method in prep for inline tests 2007-03-12 05:08:21 +00:00
Josh Coalson
5981e4f72d minor comments 2007-03-06 06:51:57 +00:00
Josh Coalson
38483802ab remove FLAC__SSE_OS restriction on SSE usage 2007-03-03 01:47:53 +00:00
Josh Coalson
0edc149c6b minor tweak for vc++ 2007-03-01 16:23:11 +00:00
Josh Coalson
8534bbe4e9 minor comments 2007-02-28 01:10:21 +00:00
Josh Coalson
6910519114 turn off FLAC__MANDATORY_VERIFY_WHILE_ENCODING 2007-02-14 05:59:27 +00:00
Josh Coalson
dc2b03b241 change default blocksize from 4608 to 4096 for LPC mode 2007-02-06 05:02:46 +00:00
Josh Coalson
d83553dd2b change the min/max rice partition order for compression levels -0 .. -6 2007-02-06 04:48:26 +00:00
Josh Coalson
df4e40f553 turn on FLAC__MANDATORY_VERIFY_WHILE_ENCODING for 1.1.4-alpha1 2007-02-04 05:49:44 +00:00
Josh Coalson
469ba74996 minor comments 2007-02-03 02:52:32 +00:00
Josh Coalson
e74bd9516c add 2007 copyright 2007-02-02 06:58:19 +00:00
Josh Coalson
f57bd7abbd *** empty log message *** 2007-02-02 06:14:04 +00:00
Josh Coalson
90c693a806 speed up precompute_partition_info_escapes_() 2007-02-01 04:24:08 +00:00
Josh Coalson
37d9fb1a89 bump requisite _MSC_VER to <=1600 for fseeko/ftello hack 2007-01-31 05:37:20 +00:00