summaryrefslogtreecommitdiff
path: root/src/libFLAC/bitwriter.c
Commit message (Collapse)AuthorAgeFilesLines
* Add and use _nofree variants of safe_realloc functionsMartijn van Beurden2022-08-201-1/+1
| | | | | | | | | | | | | | | | | Parts of the code use realloc like x = safe_realloc(x, somesize); when this is the case, the safe_realloc variant used must free the old memory block in case it fails, otherwise it will leak. However, there are also instances in the code where handling is different: if (0 == (x = safe_realloc(y, somesize))) return false in this case, y should not be freed, as y is not set to NULL we could encounter double frees. Here the safe_realloc_nofree functions are used.
* Bulk update copyright dates to 2022Martijn van Beurden2022-07-261-1/+1
|
* Increase max bitreader size to max metadata block sizeMartijn van Beurden2022-06-261-3/+5
| | | | This fixes https://github.com/xiph/flac/issues/370
* Add 32-bit encoding, including limiting of residual to 32-bit intMartijn van Beurden2022-06-121-0/+10
|
* Limit maximum size of bitwriter bufferMartijn van Beurden2022-04-171-0/+7
| | | | | | | | | | | | In the past, various bugs have triggered libFLAC to write enormous coded residuals. While these bugs have been fixed, this check is added to limit the impact of possible remaining or future bugs When a bitwriter is grown past the maximum sane size of a frame (8 channels of 65535 samples with 24 + 4 bits per sample) this indicates that such a bug was triggered. Instead of a possible crash or creating unreadable files, bitwriter_grow_ fails as if it could not allocate more memory.
* Speed up FLAC__bitwriter_write_byte_block (metadata writing)Robert Kausch2019-03-081-0/+4
|
* Fix cppcheck warningsRosen Penev2017-01-191-2/+2
| | | | Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
* Purge usage of `unsigned` typeErik de Castro Lopo2017-01-141-58/+58
| | | | | | | As pointed out by Ozkan Sezer, on some platforms `int32_t` is actually a typedef for `long` so `unsigned` cannot be used interchangably with `FLAC__uint32`. Fix is to switch from `unsigned` to explicit sized ISO C types defined in <stdint.h>.
* Bulk update copyright datesErik de Castro Lopo2016-12-051-1/+1
|
* bitwrite.c: TweaksErik de Castro Lopo2016-05-011-5/+4
| | | | | | | | | * Removes unused FLAC__WORD_ALL_ONES definition. * Add comment that unused bits of accumulator can contain garbage. * Turn assert inside FLAC__bitwriter_write_utf8_uint32 into runtime check (similar to FLAC__bitwriter_write_utf8_uint64() function). Patch-from: lvqcl <lvqcl.mail@gmail.com>
* bitwriter: Add overflow checkErik de Castro Lopo2016-01-091-62/+73
| | | | | | | | | | | | | The old version of `FLAC__bitwriter_write_raw_uint32()` assumes that the unused bits of the `val` argument are equal to zero, but don't check it. This patch adds a new version of that function which does have the check and then calls a new function `FLAC__bitwriter_write_raw_uint32_nocheck()` which behaves like the old one. Code updated to use these two functions as needed. Patch-from: lvqcl <lvqcl.mail@gmail.com>
* configure.ac: Add --enable-64-bit-words optionErik de Castro Lopo2016-01-041-1/+1
| | | | | The old 32 bit words the default which can be overridded with this configure option.
* libFLAC: Support 64bit brword/bwwordErik de Castro Lopo2016-01-041-16/+35
| | | | | | | This patch allows FLAC__BYTES_PER_WORD to be set to 8, but is disabled by default. Patch-from: lvqcl <lvqcl.mail@gmail.com>
* bitwriter.c: Cleanups and fixupsErik de Castro Lopo2015-12-311-13/+14
| | | | | | | Assertions added, assertions simplified, unnecessary assignments removed, mask calculations improved. Patch-from: lvqcl <lvqcl.mail@gmail.com>
* bitwriter.c: Fix undefined behaviourErik de Castro Lopo2015-12-201-2/+6
| | | | Patch-from: lvqcl <lvqcl.mail@gmail.com>
* libFLAC: Fix an out-of-bounds heap readErik de Castro Lopo2015-09-281-3/+5
| | | | | | | | | | | | | | | 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.
* libFLAC/bitwriter.c: Fix undefined behaviourErik de Castro Lopo2015-08-311-1/+1
|
* libFLAC/bitwriter.c: Fix undefined behaviourErik de Castro Lopo2015-08-231-1/+3
| | | | Improve folding of signed to unsgned to avoid UB.
* Update copyright years to include 2014.Erik de Castro Lopo2014-11-251-1/+1
|
* Fix all instances of '#if HAVE_CONFIG_H'.Erik de Castro Lopo2014-03-241-1/+1
| | | | | | Should be '#ifdef HAVE_CONFIG_H'. Closes: https://sourceforge.net/p/flac/bugs/410/
* Fix typos in comments.Erik de Castro Lopo2014-02-241-2/+2
| | | | Patch-from: lvqcl <lvqcl.mail@gmail.com>
* src/libFLAC/bitwriter.c : Remove dead code.Erik de Castro Lopo2013-07-171-25/+0
|
* Sun Studio can not include static function from extern inlineDagobert Michelsen2013-05-271-1/+4
| | | | Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
* Set version to 1.3.0 and update coyprights throughout.Erik de Castro Lopo2013-05-261-1/+2
|
* bitwriter.c : Add missing "extern" declarationRobert Kausch2013-05-261-0/+1
| | | | Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
* MS VS inline/extern fix from Ben Alison plus comments.Erik de Castro Lopo2013-03-121-0/+13
| | | | | | | Add explicit extern to functions that are locally declared inline but which also have non-inline public prototypes. It seems MS VS does not quite meet the C99 spec (section 6.7.4).
* Move all definitions of FLAC__U64L to one place.Erik de Castro Lopo2012-06-221-7/+1
|
* Update and improve autotools buildCristian Rodríguez2012-04-081-10/+6
| | | | | | | | | | | - 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...
* V2: Use a single definition of MIN and MAX in sourcesCristian Rodríguez2012-04-061-6/+2
|
* remove unnecesary typedef in bitwriter.cCristian Rodríguez2012-04-061-16/+15
|
* Remove casting of return value from *alloc() functions.Erik de Castro Lopo2012-04-041-3/+3
|
* Rename ENDSWAP_INT to ENDSWAP_32.Erik de Castro Lopo2012-03-051-1/+1
|
* Improve endswapping (especially purge ntohl).Erik de Castro Lopo2012-02-051-31/+4
|
* add 2009 copyrightJosh Coalson2009-01-071-1/+1
|
* fixes for windows builds (SF#1676822: ↵Josh Coalson2009-01-021-4/+7
| | | | https://sourceforge.net/tracker2/?func=detail&aid=1676822&group_id=13478&atid=113478)
* update copyright for 2008Josh Coalson2008-02-281-1/+1
|
* extra checking on memory allocation sizes to prevent a class of overflow attacksJosh Coalson2007-09-111-1/+2
|
* Some MinGW fixes (SF#1684879: ↵Josh Coalson2007-07-311-0/+2
| | | | https://sourceforge.net/tracker/index.php?func=detail&aid=1684879&group_id=13478&atid=113478)
* minor OPT tweaksJosh Coalson2007-07-231-2/+2
|
* comment out some optimized branchJosh Coalson2007-07-161-2/+2
|
* fix optimization bug in FLAC__bitwriter_write_rice_signed_block()Josh Coalson2007-07-071-2/+4
|
* minor cosmeticsJosh Coalson2007-06-201-1/+1
|
* optimize special case in FLAC__bitwriter_write_rice_signed_block()Josh Coalson2007-04-041-47/+80
|
* minor optimizations to FLAC__bitwriter_write_rice_signed_block()Josh Coalson2007-04-041-9/+11
|
* fix MSVC check for ntohl()Josh Coalson2007-02-171-1/+1
|
* Darwin fix for ntohl()Josh Coalson2007-02-131-0/+2
|
* remove some debugging outputJosh Coalson2007-02-081-6/+0
|
* use inline byte-swapping function for MSVCJosh Coalson2007-02-041-0/+13
|
* minor assertsJosh Coalson2007-02-031-7/+2
|
* add 2007 copyrightJosh Coalson2007-02-021-1/+1
|