1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00
Commit graph

1893 commits

Author SHA1 Message Date
Lasse Collin
1f6e7c68fb xz: Refactor thousand separator detection and disable it on MSVC.
Now the two variations of the format strings are created with
a macro, and the whole detection code can be easily disabled
on platforms where thousand separator formatting is known to
not work (MSVC has no support, and on DJGPP 2.05 it can have
problems in some cases).
2023-10-31 01:03:25 +08:00
Lasse Collin
ef71f83973 xz: Fix a too relaxed assertion and remove uses of SSIZE_MAX.
SSIZE_MAX isn't readily available on MSVC. Removing it means
that there is one thing less to worry when porting to MSVC.
2023-10-31 01:03:25 +08:00
Jia Tan
cf8ba7c3a8 Tests: Improve invalid unpadded size check in test_lzma_index_append().
This check was extended to test the code added to fix a failing assert
in 68bda971bb.
2023-10-31 01:02:59 +08:00
Jia Tan
4a4180ce74 Tests: Improve comments in test_index.c. 2023-10-26 06:22:24 +08:00
Jia Tan
4b23b84b89 Update THANKS. 2023-10-26 06:22:24 +08:00
Jia Tan
773f1e8622 liblzma: Update assert in vli_ceil4().
The argument to vli_ceil4() should always guarantee the return value
is also a valid lzma_vli. Thus the highest three valid lzma_vli values
are invalid arguments. All uses of the function ensure this so the
assert is updated to match this.
2023-10-26 06:22:24 +08:00
Jia Tan
68bda971bb liblzma: Add overflow check for Unpadded size in lzma_index_append().
This was not a security bug since there was no path to overflow
UINT64_MAX in lzma_index_append() or when it calls index_file_size().
The bug was discovered by a failing assert() in vli_ceil4() when called
from index_file_size() when unpadded_sum (the sum of the compressed size
of current Stream and the unpadded_size parameter) exceeds LZMA_VLI_MAX.

Previously, the unpadded_size parameter was checked to be not greater
than UNPADDED_SIZE_MAX, but no check was done once compressed_base was
added.

This could not have caused an integer overflow in index_file_size() when
called by lzma_index_append(). The calculation for file_size breaks down
into the sum of:

- Compressed base from all previous Streams
- 2 * LZMA_STREAM_HEADER_SIZE (size of the current Streams header and
  footer)
- stream_padding (can be set by lzma_index_stream_padding())
- Compressed base from the current Stream
- Unpadded size (parameter to lzma_index_append())

The sum of everything except for Unpadded size must be less than
LZMA_VLI_MAX. This is guarenteed by overflow checks in the functions
that can set these values including lzma_index_stream_padding(),
lzma_index_append(), and lzma_index_cat(). The maximum value for
Unpadded size is enforced by lzma_index_append() to be less than or
equal UNPADDED_SIZE_MAX. Thus, the sum cannot exceed UINT64_MAX since
LZMA_VLI_MAX is half of UINT64_MAX.

Thanks to Joona Kannisto for reporting this.
2023-10-26 06:22:24 +08:00
Jia Tan
b41bb79c60 Translations: Update the Esperanto translation. 2023-10-26 06:22:24 +08:00
Jia Tan
6614e6d4bf Docs: Update INSTALL for --enable-threads method win95.
The Autotools build allows win95 threads and --enable-small together now
if the compiler supports __attribute__((__constructor__)).
2023-10-26 06:22:24 +08:00
Jia Tan
bfb623ad96 CMake: Conditionally allow win95 threads and --enable-small. 2023-10-26 06:22:24 +08:00
Jia Tan
e919ebb29a Build: Conditionally allow win95 threads and --enable-small.
When the compiler supports __attribute__((__constructor__))
mythread_once() is never used, even with --enable-small. A configuration
with win95 threads and --enable-small will compile and be thread safe so
it can be allowed.

This isn't a very common configuration since MSVC does not support
__attribute__((__constructor__)), but MINGW32 and CLANG32 environments
for MSYS2 can use win95 threads and have
__attribute__((__constructor__)) support.
2023-10-26 06:22:24 +08:00
Jamaika1
c0c0cd4a48 mythread.h: Fix typo error in Vista threads mythread_once().
The "once_" variable was accidentally referred to as just "once". This
prevented building with Vista threads when
HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR was not defined.
2023-10-26 06:22:24 +08:00
Jia Tan
d93fbefcc4 Tests: Style fixes to test_lzip_decoder.c. 2023-10-26 06:22:24 +08:00
Jia Tan
65981d8e45 Translations: Update the Chinese (simplified) translation. 2023-10-26 06:22:22 +08:00
Lasse Collin
a108ed5891 xz: Omit an empty paragraph on the man page. 2023-08-02 17:39:50 +03:00
Jia Tan
03c51c5c08 Bump version and soname for 5.4.4. 2023-08-02 20:32:20 +08:00
Jia Tan
d7fa3f1b58 Add NEWS for 5.4.4. 2023-08-02 20:30:54 +08:00
Lasse Collin
6a1093c000 build-aux/manconv.sh: Fix US-ASCII and UTF-8 output.
groff defaults to SGR escapes. Using -P-c passes -c to grotty
which restores the old behavior. Perhaps there is a better way to
get pure plain text output but this works for now.
2023-08-02 15:20:31 +03:00
Lasse Collin
f6f9f5651a Update THANKS. 2023-08-01 19:10:58 +03:00
Lasse Collin
0dd83ba876 Update THANKS. 2023-08-01 18:44:02 +03:00
ChanTsune
4170a80785 mythread.h: Disable signal functions in builds targeting Wasm + WASI.
signal.h in WASI SDK doesn't currently provide sigprocmask()
or sigset_t. liblzma doesn't need them so this change makes
liblzma and xzdec build against WASI SDK. xz doesn't build yet
and the tests don't either as tuktest needs setjmp() which
isn't (yet?) implemented in WASI SDK.

Closes: https://github.com/tukaani-project/xz/pull/57
See also: https://github.com/tukaani-project/xz/pull/56

(The original commit was edited a little by Lasse Collin.)
2023-08-01 18:44:02 +03:00
Dimitri Papadopoulos Orfanos
0db6fbe0be Docs: Fix typos found by codespell 2023-08-01 18:44:02 +03:00
Jia Tan
84a3a1f4e4 Update .gitignore. 2023-08-01 18:42:23 +03:00
Jia Tan
962b3d41e0 CMake: Conditionally allow the creation of broken symlinks.
The CMake build will try to create broken symlinks on Unix and Unix-like
platforms. Cygwin and MSYS2 are Unix-like, but may not be able to create
broken symlinks. The value of the CYGWIN or MSYS environment variables
determine if broken symlinks are valid.

The default for MSYS2 does not allow for broken symlinks, so the CMake
build has been broken for MSYS2 since commit
80a1a8bb83.
2023-08-01 18:41:42 +03:00
Jia Tan
19899340cf liblzma: Prevent an empty translation unit in Windows builds.
To workaround Automake lacking Windows resource compiler support, an
empty source file is compiled to overwrite the resource files for static
library builds. Translation units without an external declaration are
not allowed by the C standard and result in a warning when used with
-Wempty-translation-unit (Clang) or -pedantic (GCC).
2023-08-01 18:41:42 +03:00
Jia Tan
ef7fbe8393 Tests: Skip .lz files in test_files.sh if not configured.
Previously if the lzip decoder was not configured then test_files.sh
would pass the lzip tests instead of skipping them.
2023-08-01 18:41:42 +03:00
Jia Tan
e49815ba7a Tests: Add ARM64 filter test to test_compress.sh. 2023-08-01 18:41:23 +03:00
Jia Tan
db5b57b827 Translations: Update the Vietnamese translation. 2023-07-31 21:26:52 +08:00
Jia Tan
e6ba501408 Translations: Update the Croatian translation. 2023-07-31 21:25:46 +08:00
Jia Tan
82657a1f10 Translations: Update the Korean man page translations. 2023-07-31 21:25:41 +08:00
Jia Tan
fab35907d1 Translations: Update the Korean translation. 2023-07-31 21:25:36 +08:00
Jia Tan
f530fe1964 Translations: Update the Polish translation. 2023-07-31 21:25:33 +08:00
Jia Tan
10b3500cc2 Translations: Update the German man page translations. 2023-07-31 21:25:30 +08:00
Jia Tan
3d14e8a34d Translations: Update the German translation. 2023-07-31 21:25:27 +08:00
Jia Tan
bdcc180a2d Translations: Update the Chinese (simplified) translation. 2023-07-31 21:25:23 +08:00
Jia Tan
844240350d Translations: Update the Swedish translation. 2023-07-31 21:25:20 +08:00
Jia Tan
bdc7952bcf Translations: Update the Ukrainian man page translations. 2023-07-31 21:25:16 +08:00
Jia Tan
143396e070 Translations: Update the Ukrainian translation. 2023-07-31 21:25:13 +08:00
Jia Tan
1b8146d64e Translations: Update the Spanish translation. 2023-07-31 21:25:09 +08:00
Jia Tan
f947ce09d7 Translations: Update the Romanian translation. 2023-07-31 21:25:05 +08:00
Jia Tan
f681301a36 Translations: Update the Romanian man page translations. 2023-07-31 21:24:58 +08:00
Jia Tan
8bc3146c6b xz: Update man page Authors and date. 2023-07-18 23:24:02 +08:00
Jia Tan
c2905540ef xz: Slight reword in xz man page for consistency.
Changed will print => prints in xz --robot --version description to
match --robot --info-memory description.
2023-07-18 23:24:02 +08:00
Jia Tan
2600d33524 liblzma: Improve comment in string_conversion.c.
The comment used "flag" when referring to decoder options. Just
referring to them as options is more clear and consistent.
2023-07-18 23:24:02 +08:00
Jia Tan
98fc14541e liblzma: Reword lzma_str_list_filters() documentation.
Reword "options required" to "options read". The previous wording
may have suggested that the options listed were all required when
the filters are used for encoding or decoding. Now it should be
more clear that the options listed are the ones relevant for
encoding or decoding.
2023-07-18 23:21:23 +08:00
Lasse Collin
1ac79b4cba xz: Translate the second "%s: " in message.c since French needs "%s : ".
This string is used to print a filename when using "xz -v" and
stderr isn't a terminal.
2023-07-18 17:41:55 +03:00
Lasse Collin
97851be2c6 xz: Make "%s: %s" translatable because French needs "%s : %s". 2023-07-18 14:37:07 +03:00
Lasse Collin
b406828a6d liblzma: Tweak #if condition in memcmplen.h.
Maybe ICC always #defines _MSC_VER on Windows but now
it's very clear which code will get used.
2023-07-18 14:03:08 +03:00
Lasse Collin
ef4a07ad94 liblzma: Omit unnecessary parenthesis in a preprocessor directive. 2023-07-18 14:03:08 +03:00
Jia Tan
64ee0caaea 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-07-18 14:03:08 +03:00