Commit graph

240 commits

Author SHA1 Message Date
Con Kolivas 3345a239b7 Use lz4 for compressibility testing only, which won't break existing archives, but speeds up testing slightly. This makes liblz4 a required library. 2021-02-16 09:41:14 +11:00
Con Kolivas de2c9c5f62 Work around corrupt archives when compressing small files with lzma to stdout. 2021-02-16 01:14:32 +11:00
Con Kolivas 590377819c Revert "Chunk size should not be zero."
This reverts commit a80c0b5e20.

Incorrect fix, needs reworking.
2021-02-16 01:10:01 +11:00
Con Kolivas dd58a58692 Put a lower bound on the amount of memory available during malloc testing and shrinking the window. 2021-02-15 15:43:06 +11:00
Con Kolivas be884d09e0 Deallocate runzip structures after all runzip chunks are complete to avoid a race in the case of a failed chunk decompressing. 2021-02-15 15:20:12 +11:00
Con Kolivas 2c7c4832b3 Move thread pthread_t to control structure for later access. 2021-02-14 20:37:03 +11:00
Con Kolivas a71f7bdb57 Make ucthreads part of the stream_info struct. 2021-02-14 20:19:47 +11:00
Con Kolivas 0d34833601 Differentiate naming of u/cthread arrays from single structs. 2021-02-14 17:16:25 +11:00
Con Kolivas e74a11c21b Use lzo1x decompress safe to cope with corrupt archives. 2021-02-14 12:58:22 +11:00
Con Kolivas a80c0b5e20 Chunk size should not be zero. 2021-02-14 11:20:53 +11:00
Con Kolivas 96c7c62584 Create a linked list to safely release data which cannot be released earlier after all compression is complete and all compressionthreads have returned, fixing a minor leak. 2021-02-09 18:05:49 +11:00
Con Kolivas 4f1adeaec4 Attempt to allocate buffer when it is larger than maxram instead of aborting without even trying. 2019-12-03 12:40:06 +11:00
Con Kolivas 86661e68bf Skip empty match blocks if they're found at the end as they may be created with incompressible data. 2019-12-03 12:22:11 +11:00
Con Kolivas 93d579a1b8 Fix misuse of static variable in a header. 2019-12-03 11:23:58 +11:00
Con Kolivas ee14f163f7
Merge pull request #134 from pete4abw/lzma-memory
Small changes to control->threads and memory overhead for LZMA.
2019-12-02 22:31:55 +11:00
Peter Hyman 9b20563ef5 Fixups to nice handling. Users can't normally lower niceness. 2019-11-26 04:50:31 -06:00
Peter Hyman 1e16f7bd02 Small changes to control->threads and memory overhead for LZMA. 2019-11-25 08:30:34 -06:00
Andrew Reading 8eba9a202e Make threaded decompression more robust on failure.
This changes the decompression worker thread to signal the main thread
in case of failure, allowing the main thread to handle this
appropriately instead of just assuming the resulting data is always good.
2019-02-23 21:09:44 -08:00
Andrew Reading 1a1723834b Fix segfault from thread race condition during decompression.
This fixes an issue where the main thread would not wait for all worker
threads to fully join before attempting to process their result buffers:
new_thread was true up until to the final N-1 calls, at which point the
input stream will have ended and new_thread would be false, then
bypassing the pthread_join()s.

The new_thread condition isn't actually necessary at all, so it has been
entirely removed.
2019-02-23 21:01:24 -08:00
Con Kolivas a81248e47d Cope with corrupt/crafted archive stream overruns. 2018-05-28 15:06:04 +10:00
Con Kolivas 3cadc63e39 Minor memleak clean ups on failures. 2018-05-28 14:39:26 +10:00
Con Kolivas cd456aa70e Fix failure to pthread join on corrupt archives calling fill_buffer again at the end of a stream. 2018-05-18 14:29:44 +10:00
Con Kolivas 399336eba4 Check for invalid last_head entries, avoiding infinite loops. 2018-05-17 15:21:40 +10:00
Con Kolivas 07bb66e284 Clean up error warnings. 2018-05-16 19:07:29 +10:00
Con Kolivas 4893e869e3 Add sanity check for invalid values during decompression, addressing CVE-2017-8845. 2018-05-16 16:55:41 +10:00
Con Kolivas 89d7b33e6a Add sanity checking on chunk data on decompression. 2018-05-16 16:51:03 +10:00
Con Kolivas 3f375385a5 Avoid crash from corrupt archive reading matches beyond end of stream. 2018-05-16 16:30:54 +10:00
Con Kolivas 1cf4460412 Missed one decomp clean up. 2018-05-16 15:13:55 +10:00
Con Kolivas a94aeb7503 Further s_buf dealloc fixes on failed decompression. 2018-05-16 14:35:06 +10:00
Con Kolivas dc57230636 Cope with compressed length being longer than uncompressed and rounding up, attending to CVE-2017-8844. 2018-05-16 14:30:15 +10:00
Con Kolivas d26970135c Minor memory cleanups for failed decompressions. 2018-05-16 14:20:38 +10:00
Con Kolivas 1971c00950 Fix assignment to deallocated buffer in failed decompression. 2018-05-16 14:16:49 +10:00
Con Kolivas d212cc1115 Use dealloc() wrapper to minimise risk of local use after free. 2018-05-16 14:12:22 +10:00
Con Kolivas 73213b9796 Merge branch 'master' into compat 2016-06-09 15:01:44 +10:00
Con Kolivas 7e92f4cb47 Fix decompression of multiple chunk encrypted archives 2016-06-09 15:00:58 +10:00
Con Kolivas 5627479c60 Tidy gotos 2016-06-09 13:56:54 +10:00
Con Kolivas 007bf5de93 Show correct lengths during testing on big endian and compressed archives 2016-06-09 11:48:04 +10:00
Con Kolivas 3dfcde4a82 Add sanity check to prevent trying to malloc more ram than a system/environment is capable of 2015-05-01 12:47:16 +10:00
Con Kolivas e39af7eb0f Add sanity check to prevent trying to malloc more ram than a system/environment is capable of 2015-05-01 12:47:03 +10:00
Con Kolivas fcb64e6dbb Do not fail if we are unable to write temporary files, giving a warning only that it might fail if we don't have enough ram 2015-04-16 16:38:20 +10:00
Con Kolivas e3598a7b96 Fix ISO C warning in lrzip.c 2015-03-10 20:04:14 +11:00
Con Kolivas e590d781f3 Brace failure lead to broken dump to stdout 2015-03-10 13:26:14 +11:00
Con Kolivas 8551a43c73 Attempt to decompress file in ram only if we are unable to create temporary files when decompressing to stdout 2015-03-10 12:05:55 +11:00
Con Kolivas c3bc42e2c8 Avoid checking return values repeatedly on compress that only lead to failures anyway 2015-03-10 09:46:35 +11:00
ckolivas f690750340 Fix remaining use of mutexes lock/unlocking in different threads with cksems, corecting cksem usage on osx 2015-03-08 10:10:38 +11:00
Con Kolivas 3f746d5d60 Use temporary file from read_seekto when STDIN will not fit in the ram input buffer 2015-03-03 13:09:00 +11:00
Con Kolivas a334444977 Remove unused read_i64 function 2015-03-03 09:35:35 +11:00
Con Kolivas 4aa69a104a Pass strict sizes to decompress length, rounding up only the amount we're allocating to not confuse decompression libraries 2014-05-30 22:05:51 +10:00
Con Kolivas 22496bdd5a Convert the thread locking to use cksems 2014-05-30 21:27:21 +10:00
Con Kolivas 6c8525893b Round up compression and decompression buffers to page size since malloc will allocate them that large anyway. 2013-09-14 12:58:31 +10:00