Commit Graph

2418 Commits

Author SHA1 Message Date
Jia Tan 17f8844e6f liblzma: Remove non-portable empty initializer.
Commit 78704f36e7 added an empty
initializer {} to prevent a warning. The empty initializer is a GNU
extension and results in a build failure on MSVC. The -wpedantic flag
warns about empty initializers.
2023-07-08 21:24:19 +08:00
Jia Tan 3aca4f629c Translations: Update the Vietnamese translation. 2023-07-08 20:03:59 +08:00
Jia Tan 66bdcfa85f Tests: Fix memory leaks in test_index.
Several tests were missing calls to lzma_index_end() to clean up the
lzma_index structs. The memory leaks were discovered by using
-fsanitize=address with GCC.
2023-06-29 00:07:16 +08:00
Jia Tan fe3bd438fb Tests: Fix memory leaks in test_block_header.
test_block_header was not properly freeing the filter options between
calls to lzma_block_header_decode(). The memory leaks were discovered by
using -fsanitize=address with GCC.
2023-06-29 00:07:05 +08:00
Jia Tan 78704f36e7 liblzma: Prevent uninitialzed warning in mt stream encoder.
This change only impacts the compiler warning since it was impossible
for the wait_abs struct in stream_encode_mt() to be used before it was
initialized since mythread_condtime_set() will always be called before
mythread_cond_timedwait().

Since the mythread.h code is different between the POSIX and
Windows versions, this warning was only present on Windows builds.

Thanks to Arthur S for reporting the warning and providing an initial
patch.
2023-06-29 00:06:16 +08:00
Jia Tan e3356a204c liblzma: Prevent warning for MSYS2 Windows build.
In lzma_memcmplen(), the <intrin.h> header file is only included if
_MSC_VER and _M_X64 are both defined but _BitScanForward64() was
previously used if _M_X64 was defined. GCC for MSYS2 defines _M_X64 but
not _MSC_VER so _BitScanForward64() was used without including
<intrin.h>.

Now, lzma_memcmplen() will use __builtin_ctzll() for MSYS2 GCC builds as
expected.
2023-06-28 23:59:51 +08:00
Jia Tan 45e250a9e9 CI: Add test with -fsanitize=address,undefined.
ci_build.sh was updated to accept disabling of __attribute__ ifunc
and CLMUL. This will allow -fsanitize=address to pass because ifunc
is incompatible with -fsanitize=address. The CLMUL implementation has
optimizations that potentially read past the buffer and mask out the
unwanted bytes.

This test will only run on Autotools Linux.
2023-06-28 23:59:47 +08:00
Jia Tan 596ee722cd CI: Upgrade checkout action from v2 to v3. 2023-06-28 20:48:49 +08:00
Jia Tan 86118ea320 Update THANKS. 2023-06-27 23:56:06 +08:00
Jia Tan 3d1fdddf92 Docs: Document the configure option --disable-ifunc in INSTALL. 2023-06-27 23:56:06 +08:00
Lasse Collin b4cf7a2822 Minor tweaks to style and comments. 2023-06-27 23:56:06 +08:00
Lasse Collin 23fb9e3a32 CMake: Rename CHECK_ATTR_IFUNC to ALLOW_ATTR_IFUNC.
It's so that there's a clear difference in wording compared
to liblzma's integrity check types.
2023-06-27 23:56:06 +08:00
Lasse Collin ee44863ae8 liblzma: Add ifunc implementation to crc64_fast.c.
The ifunc method avoids indirection via the function pointer
crc64_func. This works on GNU/Linux and probably on FreeBSD too.
The previous __attribute((__constructor__)) method is kept for
compatibility with ELF platforms which do support ifunc.

The ifunc method has some limitations, for example, building
liblzma with -fsanitize=address will result in segfaults.
The configure option --disable-ifunc must be used for such builds.

Thanks to Hans Jansen for the original patch.
Closes: https://github.com/tukaani-project/xz/pull/53
2023-06-27 23:55:59 +08:00
Hans Jansen b72d212024 Add ifunc check to CMakeLists.txt
CMake build system will now verify if __attribute__((__ifunc__())) can be
used in the build system. If so, HAVE_FUNC_ATTRIBUTE_IFUNC will be
defined to 1.
2023-06-27 15:33:15 +03:00
Hans Jansen 23b5c36fb7 Add ifunc check to configure.ac
configure.ac will now verify if __attribute__((__ifunc__())) can be used in
the build system. If so, HAVE_FUNC_ATTRIBUTE_IFUNC will be defined to 1.
2023-06-27 15:33:15 +03:00
Jia Tan dbb3a536ed CI: Add apt update command before installing dependencies.
Without the extra command, all of the CI tests were automatically
failing because the Ubuntu servers could not be reached properly.
2023-06-07 00:23:02 +08:00
Jia Tan 6bcd516812 Update THANKS. 2023-06-07 00:10:38 +08:00
Benjamin Buch 0d94ba6922
CMake: Protects against double find_package
Boost iostream uses `find_package` in quiet mode and then again uses
`find_package` with required. This second call triggers a 
`add_library cannot create imported target "ZLIB::ZLIB" because another
target with the same name already exists.`

This can simply be fixed by skipping the alias part on secondary
`find_package` runs.
2023-06-06 21:32:45 +08:00
Jia Tan 045d7aae28 Translations: Update the Esperanto translation. 2023-05-31 23:57:57 +08:00
Jia Tan b0cc7c2dce Translations: Update the Croatian translation. 2023-05-31 23:57:57 +08:00
Jia Tan af045ef6f8 Translations: Update the Chinese (simplified) translation. 2023-05-31 20:15:53 +08:00
Jia Tan e6b92d5817 Translations: Update German translation of man pages. 2023-05-17 23:12:13 +08:00
Jia Tan 592961ccdb Translations: Update the German translation. 2023-05-17 23:09:18 +08:00
Jia Tan 13572cb2c3 Translations: Update the Croatian translation. 2023-05-17 20:30:01 +08:00
Jia Tan 4e6e425ea8 Translations: Update Korean translation of man pages. 2023-05-17 20:26:54 +08:00
Jia Tan d5ef1f6faf Translations: Update the Korean translation. 2023-05-17 20:13:01 +08:00
Jia Tan e22d0b0f2e Translations: Update the Spanish translation. 2023-05-16 23:49:09 +08:00
Jia Tan f50da74d52 Translations: Update the Romanian translation. 2023-05-16 23:47:23 +08:00
Jia Tan 4b9ad60a73 Translations: Update Romanian translation of man pages. 2023-05-16 23:45:43 +08:00
Jia Tan cb6fd57f88 Translations: Update Ukrainian translation of man pages. 2023-05-16 23:44:45 +08:00
Jia Tan c3e8fcbc2d Translations: Update the Ukrainian translation. 2023-05-16 23:44:45 +08:00
Jia Tan 27b81b84fc Translations: Update the Polish translation. 2023-05-16 23:44:36 +08:00
Jia Tan 8024ad636a Translations: Update the Swedish translation. 2023-05-16 22:52:14 +08:00
Jia Tan 6699a29673 Translations: Update the Esperanto translation. 2023-05-16 21:21:38 +08:00
Jia Tan f36ca7982f liblzma: Slightly rewords lzma_str_list_filters() documentation.
Reword "options required" to "supported options". The previous may have
suggested that the options listed were all required anytime a filter is
used for encoding or decoding. The reword makes this more clear that
adjusting the options is optional.
2023-05-13 21:21:54 +08:00
Jia Tan 3374a5359e liblzma: Adds lzma_nothrow to MicroLZMA API functions.
None of the liblzma functions may throw an exception, so this
attribute should be applied to all liblzma API functions.
2023-05-12 00:00:47 +08:00
Jia Tan 8f23657498 liblzma: Exports lzma_mt_block_size() as an API function.
The lzma_mt_block_size() was previously just an internal function for
the multithreaded .xz encoder. It is used to provide a recommended Block
size for a given filter chain.

This function is helpful to determine the maximum Block size for the
multithreaded .xz encoder when one wants to change the filters between
blocks. Then, this determined Block size can be provided to
lzma_stream_encoder_mt() in the lzma_mt options parameter when
intializing the coder. This requires one to know all the filter chains
they are using before starting to encode (or at least the filter chain
that will need the largest Block size), but that isn't a bad limitation.
2023-05-11 23:54:44 +08:00
Jia Tan d0f33d672a liblzma: Creates IS_ENC_DICT_SIZE_VALID() macro.
This creates an internal liblzma macro to test if the dictionary size
is valid for encoding.
2023-05-11 22:28:45 +08:00
Jia Tan c247d06e1f Add NEWS for 5.4.3. 2023-05-04 22:15:35 +08:00
Jia Tan 77050b7836 Add NEWS for 5.2.12. 2023-05-04 22:15:30 +08:00
Jia Tan 713e15e43e Translations: Update the Croatian translation. 2023-05-04 20:38:52 +08:00
Jia Tan 9ad64bdf30 tuklib_integer.h: Reverts previous commit.
Previous commit 6be460dde0 would cause an
error if the integer size was 32 bit.
2023-05-04 20:30:25 +08:00
Jia Tan 6be460dde0 tuklib_integer.h: Changes two other UINT_MAX == UINT32_MAX to >=. 2023-05-04 19:25:20 +08:00
Lasse Collin 44c0c5eae9 tuklib_integer.h: Fix a recent copypaste error in Clang detection.
Wrong line was changed in 7062348bf3.
Also, this has >= instead of == since ints larger than 32 bits would
work too even if not relevant in practice.
2023-05-03 22:55:16 +03:00
Jia Tan 2cf5ae5b5b CI: Adds a build and test for small configuration. 2023-04-25 22:14:28 +08:00
Jia Tan 16b81a057a CI: ci_build.sh allows configuring small build. 2023-04-25 20:05:26 +08:00
Jia Tan 78ccd93951 Update THANKS. 2023-04-20 20:15:00 +08:00
Jia Tan f41df2ac2f Windows: Include <intrin.h> when needed.
Legacy Windows did not need to #include <intrin.h> to use the MSVC
intrinsics. Newer versions likely just issue a warning, but the MSVC
documentation says to include the header file for the intrinsics we use.

GCC and Clang can "pretend" to be MSVC on Windows, so extra checks are
needed in tuklib_integer.h to only include <intrin.h> when it will is
actually needed.
2023-04-19 22:22:16 +08:00
Jia Tan 7062348bf3 tuklib_integer: Use __builtin_clz() with Clang.
Clang has support for __builtin_clz(), but previously Clang would
fallback to either the MSVC intrinsic or the regular C code. This was
discovered due to a bug where a new version of Clang required the
<intrin.h> header file in order to use the MSVC intrinsics.

Thanks to Anton Kochkov for notifying us about the bug.
2023-04-19 21:59:03 +08:00
Lasse Collin 3938718ce3 liblzma: Update project maintainers in lzma.h.
AUTHORS was updated earlier, lzma.h was simply forgotten.
2023-04-14 18:42:33 +03:00