]> git.ipfire.org Git - thirdparty/xz.git/log
thirdparty/xz.git
3 months agoxz: Capsicum sandbox: Fix incorrect use of cap_rights_clear() v5.4
Lasse Collin [Mon, 28 Apr 2025 15:22:32 +0000 (18:22 +0300)] 
xz: Capsicum sandbox: Fix incorrect use of cap_rights_clear()

cap_rights_clear() with no additional arguments acts as a no-op, so
instead of removing all capability rights from STDIN_FILENO, the same
rights were allowed for STDIN_FILENO as were allowed for src_fd.

Co-authored-by: Guillaume Outters <guillaume-installs@outters.eu>
Fixes: fd56d5353360 ("xz: Make Capsicum sandbox more strict with stdin and stdout.")
(The commit message says "stdout". It should have said "stderr".)

(based on commit 5cc2e479eb447a444f5ab005fc36b7f275c75eb5)

4 months agoliblzma: mt dec: Fix lack of parallelization in single-shot decoding
Lasse Collin [Thu, 3 Apr 2025 11:34:42 +0000 (14:34 +0300)] 
liblzma: mt dec: Fix lack of parallelization in single-shot decoding

Single-shot decoding means calling lzma_code() by giving it the whole
input at once and enough output buffer space to store the uncompressed
data, and combining this with LZMA_FINISH and no timeout
(lzma_mt.timeout = 0). This way the file is decoded with a single
lzma_code() call if possible.

The bug prevented the decoder from starting more than one worker thread
in single-shot mode. The issue was noticed when reviewing the code;
there are no bug reports. Thus maybe few have tried this mode.

Fixes: 64b6d496dc81 ("liblzma: Threaded decoder: Always wait for output if LZMA_FINISH is used.")
(cherry picked from commit 0c80045ab82c406858d9d5bcea9f48ebc3d0a81d)

4 months agoliblzma: mt dec: Don't modify thr->in_size in the worker thread
Lasse Collin [Thu, 3 Apr 2025 11:34:42 +0000 (14:34 +0300)] 
liblzma: mt dec: Don't modify thr->in_size in the worker thread

Don't set thr->in_size = 0 when returning the thread to the stack of
available threads. Not only is it useless, but the main thread may
read the value in SEQ_BLOCK_THR_RUN. With valid inputs, it made
no difference if the main thread saw the original value or 0. With
invalid inputs (when worker thread stops early), thr->in_size was
no longer modified after the previous commit with the security fix
("Don't free the input buffer too early").

So while the bug appears harmless now, it's important to fix it because
the variable was being modified without proper locking. It's trivial
to fix because there is no need to change the value. Only main thread
needs to set the value in (in SEQ_BLOCK_THR_INIT) when starting a new
Block before the worker thread is activated.

Fixes: 4cce3e27f529 ("liblzma: Add threaded .xz decompressor.")
Reviewed-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Thanks-to: Sam James <sam@gentoo.org>
(cherry picked from commit 8188048854e8d11071b8a50d093c74f4c030acc9)

4 months agoliblzma: mt dec: Don't free the input buffer too early (CVE-2025-31115)
Lasse Collin [Thu, 3 Apr 2025 11:34:42 +0000 (14:34 +0300)] 
liblzma: mt dec: Don't free the input buffer too early (CVE-2025-31115)

The input buffer must be valid as long as the main thread is writing
to the worker-specific input buffer. Fix it by making the worker
thread not free the buffer on errors and not return the worker thread to
the pool. The input buffer will be freed when threads_end() is called.

With invalid input, the bug could at least result in a crash. The
effects include heap use after free and writing to an address based
on the null pointer plus an offset.

The bug has been there since the first committed version of the threaded
decoder and thus affects versions from 5.3.3alpha to 5.8.0.

As the commit message in 4cce3e27f529 says, I had made significant
changes on top of Sebastian's patch. This bug was indeed introduced
by my changes; it wasn't in Sebastian's version.

Thanks to Harri K. Koskinen for discovering and reporting this issue.

Fixes: 4cce3e27f529 ("liblzma: Add threaded .xz decompressor.")
Reported-by: Harri K. Koskinen <x64nop@nannu.org>
Reviewed-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Thanks-to: Sam James <sam@gentoo.org>
(cherry picked from commit d5a2ffe41bb77b918a8c96084885d4dbe4bf6480)

4 months agoliblzma: mt dec: Simplify by removing the THR_STOP state
Lasse Collin [Thu, 3 Apr 2025 11:34:42 +0000 (14:34 +0300)] 
liblzma: mt dec: Simplify by removing the THR_STOP state

The main thread can directly set THR_IDLE in threads_stop() which is
called when errors are detected. threads_stop() won't return the stopped
threads to the pool or free the memory pointed by thr->in anymore, but
it doesn't matter because the existing workers won't be reused after
an error. The resources will be cleaned up when threads_end() is
called (reinitializing the decoder always calls threads_end()).

Reviewed-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Thanks-to: Sam James <sam@gentoo.org>
(cherry picked from commit c0c835964dfaeb2513a3c0bdb642105152fe9f34)

4 months agoliblzma: mt dec: Fix a comment
Lasse Collin [Thu, 3 Apr 2025 11:34:42 +0000 (14:34 +0300)] 
liblzma: mt dec: Fix a comment

Reviewed-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Thanks-to: Sam James <sam@gentoo.org>
(cherry picked from commit 831b55b971cf579ee16a854f177c36b20d3c6999)

4 months agoliblzma: Add assertions to lzma_bufcpy()
Lasse Collin [Thu, 3 Apr 2025 11:34:30 +0000 (14:34 +0300)] 
liblzma: Add assertions to lzma_bufcpy()

(cherry picked from commit b9d168eee4fb6393b4fe207c0aeb5faee316ca1a)

10 months agocmake/tuklib_large_file_support.cmake: Add a missing include
Lasse Collin [Tue, 1 Oct 2024 11:49:41 +0000 (14:49 +0300)] 
cmake/tuklib_large_file_support.cmake: Add a missing include

v5.2 didn't build with CMake. Other branches had
include(CMakePushCheckState) in top-level CMakeLists.txt
which made the build work.

Fixes: 597f49b61475438a43a417236989b2acc968a686
(cherry picked from commit be4bf94446b6286a5dffdde85fc1d21448f4edff)

10 months agoWindows: Embed an application manifest in the EXE files
Lasse Collin [Tue, 1 Oct 2024 09:10:23 +0000 (12:10 +0300)] 
Windows: Embed an application manifest in the EXE files

IMPORTANT: This includes a security fix to command line tool
           argument handling.

Some toolchains embed an application manifest by default to declare
UAC-compliance. Some also declare compatibility with Vista/8/8.1/10/11
to let the app access features newer than those of Vista.

We want all the above but also two more things:

  - Declare that the app is long path aware to support paths longer
    than 259 characters (this may also require a registry change).

  - Force the code page to UTF-8. This allows the command line tools
    to access files whose names contain characters that don't exist
    in the current legacy code page (except unpaired surrogates).
    The UTF-8 code page also fixes security issues in command line
    argument handling which can be exploited with malicious filenames.

Thanks to Orange Tsai and splitline from DEVCORE Research Team
for discovering this issue.

Thanks to Vijay Sarvepalli for reporting the issue to me.

Thanks to Kelvin Lee for testing with MSVC and helping with
the required build system fixes.

(cherry picked from commit 46ee0061629fb075d61d83839e14dd193337af59)

14 months agoBump version and soname for 5.4.7 v5.4.7
Lasse Collin [Wed, 29 May 2024 15:00:35 +0000 (18:00 +0300)] 
Bump version and soname for 5.4.7

14 months agoAdd NEWS for 5.4.7
Lasse Collin [Wed, 29 May 2024 15:00:35 +0000 (18:00 +0300)] 
Add NEWS for 5.4.7

14 months agoAdd NEWS for 5.2.13
Lasse Collin [Wed, 29 May 2024 15:00:35 +0000 (18:00 +0300)] 
Add NEWS for 5.2.13

14 months agoBuild: Update po/*.po files only when needed
Lasse Collin [Wed, 29 May 2024 13:33:24 +0000 (16:33 +0300)] 
Build: Update po/*.po files only when needed

When po/xz.pot doesn't exist, running "make" or "make dist" will
create it. Then the .po files will be updated but only if they
actually would change more than the POT-Creation-Date line.
Then the .gmo files would be generated from the .po files.
This is the case before and after this commit.

However, "make dist" and thus "make mydist" did a forced update
to the files, updating them even if the only change was the
POT-Creation-Date line. This had pros and cons: It made it clear
that the .po file really is in sync with the recent strings in
the package. On the other hand, it added noise in form of changed
files in the source tree and distribution tarballs. It can be
ignored with something like "diff -I'^"POT-Creation-Date: '" but
it's still a minor annoyance *if* there's not enough value in
having the most recent timestamp.

Setting DIST_DEPENDS_ON_UPDATE_PO = no means that such forced
update won't happen in "make dist" anymore. However, the "mydist"
target will use xz.pot-update target which is the same target that
is run when xz.pot doesn't exist at all yet. Thus "mydist" will
ensure that the translations are up to date, without noise from
changes that would affect only the POT-Creation-Date line.

Note that po4a always uses msgmerge with --update, so POT-Creation-Date
in the man page translations is never the only change in .po files.
In that sense this commit makes the message translations behave more
similarly to the man page translations.

Distribution tarballs will still have non-reproducible POT-Creation-Date
in po/xz.pot and po4a/xz-man.pot but those are just two files. Even they
could be made reproducible from a Git timestamp if desired.

(cherry picked from commit 9284f1aea31f0eb23e2ea72f7218b271e2234762)

14 months agoTranslations: Run "make -C po update-po"
Lasse Collin [Tue, 28 May 2024 18:32:58 +0000 (21:32 +0300)] 
Translations: Run "make -C po update-po"

In the past this wasn't done before releases; the Git repository
just contained the files from the Translation Project. But this
way it is clearer when comparing release tarballs against the
Git repository.

14 months agoTranslations: Run po4a/update-po and cleanup unused strings
Lasse Collin [Tue, 28 May 2024 18:18:28 +0000 (21:18 +0300)] 
Translations: Run po4a/update-po and cleanup unused strings

The v5.4 branch won't get any translation updates so the fuzzy
strings and obsolete strings are all useless. Cleaning them up
makes the files smaller.

    ./update-po

    for I in *.po
    do
        msgattrib --clear-fuzzy --clear-previous --empty \
                  --no-obsolete --no-wrap "$I" > tmp
        mv tmp "$I"
    done

The po4a run gave "Parse error at" message from fr.po but
after the fr.po was rewritten the error is gone.

14 months agopo4a/update-po: Disable wrapping in .pot and .po files
Lasse Collin [Tue, 28 May 2024 18:10:33 +0000 (21:10 +0300)] 
po4a/update-po: Disable wrapping in .pot and .po files

The .po files from the Translation Project come with unwrapped
strings so this matches it.

This may reduce the noise in diffs too. When the beginning of
a paragraph had changed, the rest of the lines got rewrapped
in msgsid. Now it's just one very long line that changes when
a paragraph has been edited.

The --add-location=file option was removed as redundant. The line
numbers don't exist in the .pot file due to --porefs file and thus
they cannot get copied to the .po files either.

(cherry picked from commit 4beba1cd62d7f8f7a6f1e899b68292d94c53b599)

14 months agoUpdate contact info in README
Lasse Collin [Tue, 28 May 2024 15:36:53 +0000 (18:36 +0300)] 
Update contact info in README

(cherry picked from commit b14c130a58a649f9a73392eeb122cb252327c569)

14 months agoTranslations: Use --package-name=xz-man with po4a
Lasse Collin [Tue, 28 May 2024 10:25:07 +0000 (13:25 +0300)] 
Translations: Use --package-name=xz-man with po4a

This is to match reality. See the added comment.

(cherry picked from commit 75f5f2e014b0ee646963f36bc6a9c840fb272353)

14 months agoTranslations: Omit man page line numbers from .pot and .po files
Lasse Collin [Mon, 27 May 2024 22:17:45 +0000 (01:17 +0300)] 
Translations: Omit man page line numbers from .pot and .po files

(cherry picked from commit 9114267038deaecf4832a5cacb5acbe6591ac839)

14 months agoTranslations: Update po/Makevars
Lasse Collin [Tue, 28 May 2024 14:10:19 +0000 (17:10 +0300)] 
Translations: Update po/Makevars

Use the template from gettext 0.22.5.
Add --add-location=file to XGETTEXT_OPTIONS and MSGMERGE_OPTIONS.
Add --no-wrap to MSGINIT_OPTIONS.

14 months agoliblzma: Omit an unneeded array from the x86 filter
Lasse Collin [Mon, 6 May 2024 20:00:09 +0000 (23:00 +0300)] 
liblzma: Omit an unneeded array from the x86 filter

Fixes: 6aa2a6deeba04808a0fe4461396e7fb70277f3d4
(cherry picked from commit de06b9f0c0a3f72569829ecadbc9c0a3ef099f57)

14 months agoliblzma: Silence a warning from Coverity static analysis
Lasse Collin [Fri, 19 Apr 2024 19:04:21 +0000 (22:04 +0300)] 
liblzma: Silence a warning from Coverity static analysis

It is logical why it cannot know for sure that the value has
to be at most 4 if it is less than 16.

The x86 filter is based on a very old LZMA SDK version. Newer
ones have quite a different implementation for the same filter.

Thanks to Sam James.

(cherry picked from commit 6aa2a6deeba04808a0fe4461396e7fb70277f3d4)

14 months agoFix typos
Lasse Collin [Fri, 17 May 2024 21:34:07 +0000 (00:34 +0300)] 
Fix typos

Thanks to xx on #tukaani.

(cherry picked from commit 4e9023857d287f624562156b60dc23d2b64c0f10)

14 months agoliblzma: Fix white space
Lasse Collin [Fri, 17 May 2024 21:23:52 +0000 (00:23 +0300)] 
liblzma: Fix white space

Thanks to xx on #tukaani.

(cherry picked from commit b14d08fbbc254485ace9ccfe7908674f608a62ae)

14 months agoUpdate maintainer and author info.
Lasse Collin [Mon, 8 Apr 2024 15:27:39 +0000 (18:27 +0300)] 
Update maintainer and author info.

The other maintainer suddenly disappeared.

(cherry picked from commit 77a294d98a9d2d48f7e4ac273711518bf689f5c4)

14 months agoAdd NEWS for 5.2.11 and 5.2.12
Lasse Collin [Tue, 7 May 2024 17:42:48 +0000 (20:42 +0300)] 
Add NEWS for 5.2.11 and 5.2.12

14 months agoliblzma: Fix incorrect function type error from sanitizer
Lasse Collin [Tue, 30 Apr 2024 19:22:45 +0000 (22:22 +0300)] 
liblzma: Fix incorrect function type error from sanitizer

Clang 17 with -fsanitize=address,undefined:

    src/liblzma/common/filter_common.c:366:8: runtime error:
        call to function encoder_find through pointer to incorrect
        function type 'const lzma_filter_coder *(*)(unsigned long)'
    src/liblzma/common/filter_encoder.c:187: note:
        encoder_find defined here

Use a wrapper function to get the correct type neatly.
This reduces the number of casts needed too.

This issue could be a problem with control flow integrity (CFI)
methods that check the function type on indirect function calls.

Fixes: 3b34851de1eaf358cf9268922fa0eeed8278d680
(cherry picked from commit 278563ef8f2b8d98d7f2c85e1a64ec1bc21d26d8)

14 months agoxz: Avoid arithmetic on a null pointer
Lasse Collin [Tue, 30 Apr 2024 18:41:11 +0000 (21:41 +0300)] 
xz: Avoid arithmetic on a null pointer

It's undefined behavior. The result wasn't ever used as it occurred
in the last iteration of a loop.

Clang 17 with -fsanitize=address,undefined:

    $ src/xz/xz --block-list=123
    src/xz/args.c:164:12: runtime error: applying non-zero offset 1
        to null pointer

Fixes: 88ccf47205d7f3aa314d358c72ef214f10f68b43
Co-authored-by: Sam James <sam@gentoo.org>
(cherry picked from commit 77c8f60547decefca8f2d0c905d9c708c38ee8ff)

14 months agoTests: test_index: Fix failures when features are disabled
Lasse Collin [Sat, 27 Apr 2024 22:34:50 +0000 (01:34 +0300)] 
Tests: test_index: Fix failures when features are disabled

Fixes: cd88423e76d54eb72aea037364f3ebb21f122503
(cherry picked from commit 710a4573ef2cbd19c66318c3b2d1388e418e26c7)

14 months agoTests: test_index: Edit a misleading test
Lasse Collin [Sat, 27 Apr 2024 15:30:40 +0000 (18:30 +0300)] 
Tests: test_index: Edit a misleading test

(cherry picked from commit d879686469c9c4bf2a7c0bb6420ebe4530fc8f07)

14 months agoTests: test_index: Use minimal values to test integer overflow
Lasse Collin [Sat, 27 Apr 2024 13:46:01 +0000 (16:46 +0300)] 
Tests: test_index: Use minimal values to test integer overflow

(cherry picked from commit 612005bbdb0dea9dc09e9e2e9cc16a15c1480acd)

14 months agoTests: test_index: Test lzma_index_buffer_decode() more
Lasse Collin [Sat, 27 Apr 2024 12:13:39 +0000 (15:13 +0300)] 
Tests: test_index: Test lzma_index_buffer_decode() more

(cherry picked from commit 4ad88b2544c2aaf8de8f38af54587098cbe66c1d)

14 months agoTests: test_index: Test that *i = NULL is done on LZMA_PROG_ERROR
Lasse Collin [Sat, 27 Apr 2024 12:08:29 +0000 (15:08 +0300)] 
Tests: test_index: Test that *i = NULL is done on LZMA_PROG_ERROR

On LZMA_DATA_ERROR from lzma_index_buffer_decode(), *i = NULL was
already done but this adds a test for that case too.

(cherry picked from commit 575b11b0d291e66c5fce31ce7a72f11436d57c83)

14 months agoTests: test_index: Test lzma_index_buffer_encode() with empty output buf
Lasse Collin [Sat, 27 Apr 2024 12:01:25 +0000 (15:01 +0300)] 
Tests: test_index: Test lzma_index_buffer_encode() with empty output buf

(cherry picked from commit 2c970debdb285823f01f75e875561d893345ac2b)

14 months agoTests: test_index: Replace if-statements with tuktest assertions
Lasse Collin [Sat, 27 Apr 2024 11:59:55 +0000 (14:59 +0300)] 
Tests: test_index: Replace if-statements with tuktest assertions

(cherry picked from commit cd88423e76d54eb72aea037364f3ebb21f122503)

14 months agoTests: test_index: Make it clear that my_alloc() has no integer overflows
Lasse Collin [Sat, 27 Apr 2024 11:56:16 +0000 (14:56 +0300)] 
Tests: test_index: Make it clear that my_alloc() has no integer overflows

liblzma guarantees that the product of the allocation size arguments
will fit in size_t.

Putting the pre-increment in the if-statement was clearly wrong
although in practice it didn't matter here as the function is
called only a couple of times.

(cherry picked from commit 7f865577a6224fbbb5f5ca52574b62ea8ac9bf51)

14 months agoTests: test_index: Verify also iter.block.number_in_stream
Lasse Collin [Sat, 27 Apr 2024 11:51:52 +0000 (14:51 +0300)] 
Tests: test_index: Verify also iter.block.number_in_stream

(cherry picked from commit 12313a3b6596cdcf012e180597f84d231f8730d3)

14 months agoTests: test_index: Check cases that aren't a multiple of 4 bytes
Lasse Collin [Sat, 27 Apr 2024 11:51:06 +0000 (14:51 +0300)] 
Tests: test_index: Check cases that aren't a multiple of 4 bytes

(cherry picked from commit ad2654010d9d641ce1601beeff00630027e6bcd4)

14 months agoliblzma: index_decoder: Fix missing initializations on LZMA_PROG_ERROR
Lasse Collin [Sat, 27 Apr 2024 11:33:38 +0000 (14:33 +0300)] 
liblzma: index_decoder: Fix missing initializations on LZMA_PROG_ERROR

If the arguments to lzma_index_decoder() or lzma_index_buffer_decode()
were such that LZMA_PROG_ERROR was returned, the lzma_index **i
argument wasn't touched even though the API docs say that *i = NULL
is done if an error occurs. This obviously won't be done even now
if i == NULL but otherwise it is best to do it due to the wording
in the API docs.

In practice this matters very little: The problem can occur only
if the functions are called with invalid arguments, that is,
the calling application must already have a bug.

(cherry picked from commit 71eed2520e2eecae89bade9dceea16e56cfa2ea0)

14 months agoCMake: Bump maximum policy version to 3.29
Lasse Collin [Tue, 7 May 2024 16:30:19 +0000 (19:30 +0300)] 
CMake: Bump maximum policy version to 3.29

14 months agoliblzma: API doc cleanups
Lasse Collin [Tue, 23 Apr 2024 22:20:26 +0000 (01:20 +0300)] 
liblzma: API doc cleanups

(cherry picked from commit 08ab0966a75b501aa7c717622223f0c13a113c75)

14 months agoTests: test_filter_str: Add a few assertions
Lasse Collin [Tue, 23 Apr 2024 13:35:33 +0000 (16:35 +0300)] 
Tests: test_filter_str: Add a few assertions

(cherry picked from commit 3ac8a9bb4cccbee88350696dc9c645c48d77c989)

14 months agoTests: test_filter_str: Move one assertion and add a comment
Lasse Collin [Tue, 23 Apr 2024 13:35:08 +0000 (16:35 +0300)] 
Tests: test_filter_str: Move one assertion and add a comment

(cherry picked from commit 26c69be80523b05c84dea86c47c4ddd9a10945d7)

14 months agoTests: test_filter_str: Tweak comments and white space
Lasse Collin [Tue, 23 Apr 2024 13:26:06 +0000 (16:26 +0300)] 
Tests: test_filter_str: Tweak comments and white space

(cherry picked from commit 4f6af853bc99904efb8b6c28a0af7b81a8476c1b)

14 months agoTests: test_filter_str: Test *error_pos more thoroughly
Lasse Collin [Mon, 22 Apr 2024 19:23:32 +0000 (22:23 +0300)] 
Tests: test_filter_str: Test *error_pos more thoroughly

(cherry picked from commit b0366df1d7ed26268101f9303a001c91c0806dfc)

14 months agoliblzma: lzma_str_to_filters: Set *error_pos on all errors
Lasse Collin [Mon, 22 Apr 2024 18:54:39 +0000 (21:54 +0300)] 
liblzma: lzma_str_to_filters: Set *error_pos on all errors

The API docs clearly say that if error_pos isn't NULL then *error
is always set on any error. However, it wasn't touched if str == NULL
or filters == NULL or unsupported flags were specified.

Fixes: cedeeca2ea6ada5b0411b2ae10d7a859e837f203
(cherry picked from commit 70d12dd069bb9bb0d6bb1c8fafc4e6f77780263d)

14 months agoxz man page: Use .ft CR instead of CW to silence warnings from groff.
Lasse Collin [Mon, 8 Apr 2024 18:19:38 +0000 (21:19 +0300)] 
xz man page: Use .ft CR instead of CW to silence warnings from groff.

(cherry picked from commit 31ef676567c9d6fcc4ec9fc833c312f7a7c21c48)

14 months agoDocs: Update .xz file format specification to 1.2.1.
Lasse Collin [Mon, 8 Apr 2024 15:05:32 +0000 (18:05 +0300)] 
Docs: Update .xz file format specification to 1.2.1.

This only reverts the XZ URL changes.

(cherry picked from commit 8dd03d4484ccf80022722a16d0ed9b37f2b58072)

14 months agoUpdate website URLs back to tukaani.org.
Lasse Collin [Mon, 8 Apr 2024 14:33:56 +0000 (17:33 +0300)] 
Update website URLs back to tukaani.org.

The XZ projects were moved back to their original URLs.

(cherry picked from commit 17aa2e1a796d3f758802df29afc89dcf335db567)

14 months agoUpdate THANKS.
Lasse Collin [Tue, 9 Apr 2024 15:22:16 +0000 (18:22 +0300)] 
Update THANKS.

(cherry picked from commit db4dd74a344580e0b81436598d9741a3454245b0)

14 months agoINSTALL: Document arguments of --enable-symbol-versions.
Lasse Collin [Fri, 15 Mar 2024 15:43:39 +0000 (17:43 +0200)] 
INSTALL: Document arguments of --enable-symbol-versions.

(cherry picked from commit 8a25ba024d55610c448c6e4f1400a00bae51b493)

14 months agoBuild: Use only the generic symbol versioning with NVIDIA HPC Compiler.
Lasse Collin [Fri, 15 Mar 2024 15:15:50 +0000 (17:15 +0200)] 
Build: Use only the generic symbol versioning with NVIDIA HPC Compiler.

This does the previous commit with CMake.

AC_EGREP_CPP uses AC_REQUIRE so the outermost if-commands must
be changed to AS_IF to ensure that things wont break some day.
See 5a5bd7f871818029d5ccbe189f087f591258c294.

(cherry picked from commit 49324b711f9d42b3543bf2f3ae598eaa03360bd5)

14 months agoCMake: Use only the generic symbol versioning with NVIDIA HPC Compiler.
Lasse Collin [Fri, 15 Mar 2024 14:36:35 +0000 (16:36 +0200)] 
CMake: Use only the generic symbol versioning with NVIDIA HPC Compiler.

It doesn't support the __symver__ attribute or __asm__(".symver ...").
The generic symbol versioning can still be used since it only needs
linker support.

(cherry picked from commit c273123ed0ebaebf49994057a7fe98aae7f42c40)

14 months agoUpdate THANKS.
Lasse Collin [Wed, 13 Mar 2024 19:38:24 +0000 (21:38 +0200)] 
Update THANKS.

(cherry picked from commit df7f487648d18a3992386a59b8a061edca862d17)

14 months agoliblzma: Minor comment edits.
Lasse Collin [Wed, 13 Mar 2024 19:30:18 +0000 (21:30 +0200)] 
liblzma: Minor comment edits.

(cherry picked from commit 3217b82b3ec023bf8338249134a076bea0ea30ec)

14 months agoliblzma: Fix building with NVHPC (NVIDIA HPC SDK).
Sergey Kosukhin [Wed, 13 Mar 2024 12:07:13 +0000 (13:07 +0100)] 
liblzma: Fix building with NVHPC (NVIDIA HPC SDK).

NVHPC compiler has several issues that make it impossible to
build liblzma:
  - the compiler cannot handle unions that contain pointers that
    are not the first members;
  - the compiler fails to produce valid code for delta_decode if the
    vectorization is enabled, which results in failed tests.

This introduces NVHPC-specific workarounds that address the issues.

(This commit was contributed under 0BSD but the author confirmed
that it is fine to backport it to the public domain branches. See
https://github.com/tukaani-project/xz/pull/90#issuecomment-2100185936
and the next two messages.)

(cherry picked from commit 096bc0e3f8fb4bfc4d2f3f64a7f219401ffb4c31)

14 months agoCMake: Disable symbol versioning on non-glibc Linux.
Lasse Collin [Wed, 13 Mar 2024 19:17:10 +0000 (21:17 +0200)] 
CMake: Disable symbol versioning on non-glibc Linux.

This better matches what configure.ac does. For example, musl has
only basic symbol versioning support:

https://wiki.musl-libc.org/functional-differences-from-glibc.html#Symbol_versioning

configure.ac tries to enable symbol versioning only with glibc
so now CMake does the same.

(cherry picked from commit 2ad7fad67080e88fa7fc191f9d613d8b7add9c62)

14 months agoCMake: Make symbol versioning configurable.
Lasse Collin [Wed, 13 Mar 2024 18:32:46 +0000 (20:32 +0200)] 
CMake: Make symbol versioning configurable.

(cherry picked from commit 82f0c0d39eb2c026b1d96ee706f70ace868d4ed4)

14 months agoCMake: Handle symbol versioning on MicroBlaze specially.
Lasse Collin [Sun, 18 Feb 2024 12:59:52 +0000 (14:59 +0200)] 
CMake: Handle symbol versioning on MicroBlaze specially.

This is to match configure.ac.

(cherry picked from commit 025eb6d7879e4c4e8cb29716b371e0f4c1aea660)

14 months agoBuild: Style tweaks to configure.ac.
Lasse Collin [Wed, 13 Mar 2024 17:47:36 +0000 (19:47 +0200)] 
Build: Style tweaks to configure.ac.

The AC_MSG_ERROR line is overlong anyway as are a few other
AC_MSG_ERROR lines already.

(cherry picked from commit 45d33bfc45e4295b8ad743bc2ae61cc724f98076)

14 months agoBuild: Let the users override the symbol versioning variant.
Sergey Kosukhin [Tue, 12 Mar 2024 19:03:49 +0000 (20:03 +0100)] 
Build: Let the users override the symbol versioning variant.

There are cases when the users want to decide themselves whether
they want to have the generic (even on GNU/Linux) or the linux
(even if we do not recommend that) symbol versioning variant.
The former might be needed to circumvent compiler issues (i.e.
the compiler does not support all features that are required
for the linux versioning), the latter might help in overriding
the assumptions made in the configure script.

(This commit was contributed under 0BSD but the author confirmed
that it is fine to backport it to the public domain branches. See
https://github.com/tukaani-project/xz/pull/90#issuecomment-2100185936
and the next two messages.)

(cherry picked from commit f56ed6fac6619b56b005878d3b5210e2f0d721c0)

14 months agoINSTALL: Clarify that --disable-assembler affects only 32-bit x86.
Lasse Collin [Wed, 21 Feb 2024 15:41:32 +0000 (17:41 +0200)] 
INSTALL: Clarify that --disable-assembler affects only 32-bit x86.

(cherry picked from commit 00440f52be9ac2c7438c7b0cb1082f12399632c6)

14 months agoxz: Delete old commented-out code.
Lasse Collin [Sat, 17 Feb 2024 21:07:35 +0000 (23:07 +0200)] 
xz: Delete old commented-out code.

(cherry picked from commit 4ce300ce0884c6e552de2af9ae8050b47b01f0e7)

14 months agoxz: Tweak comments.
Lasse Collin [Sat, 17 Feb 2024 21:07:35 +0000 (23:07 +0200)] 
xz: Tweak comments.

(cherry picked from commit 7312dfbb02197c7f990c7a3cefd027a9387d1473)

14 months agoxz: Fix message_init() description.
Lasse Collin [Sat, 17 Feb 2024 21:07:35 +0000 (23:07 +0200)] 
xz: Fix message_init() description.

Also explicitly initialize progress_automatic to make it clear
that it can be read before message_init() sets it. Static variable
was initialized to false by default already so this is only for
clarity.

(cherry picked from commit c701a5909ad9882469fbab4fab5d2d5556d3ba78)

14 months agoBuild: Don't install TODO.
Lasse Collin [Sat, 17 Feb 2024 17:25:05 +0000 (19:25 +0200)] 
Build: Don't install TODO.

(cherry picked from commit f3440e78c9517db75bfa52e1a378fad60b073bbe)

14 months agoUpdate m4/.gitignore.
Jia Tan [Thu, 15 Feb 2024 14:26:43 +0000 (22:26 +0800)] 
Update m4/.gitignore.

(cherry picked from commit 4323bc3e0c1e1d2037d5e670a3bf6633e8a3031e)

14 months agoTests: tuktest.h: Add a missing word to a comment.
Lasse Collin [Wed, 14 Feb 2024 19:11:03 +0000 (21:11 +0200)] 
Tests: tuktest.h: Add a missing word to a comment.

(cherry picked from commit cce7330b9f23485a0879422e0c3395a7065439ac)

14 months agoTests: tuktest.h: Fix the comment about STest.
Lasse Collin [Wed, 14 Feb 2024 19:10:10 +0000 (21:10 +0200)] 
Tests: tuktest.h: Fix the comment about STest.

(cherry picked from commit 5dd8fc9452a3373cedc27379067ce638f992c741)

14 months agoDocs: Include doc/examples/11_file_info.c in tarballs.
Lasse Collin [Wed, 14 Feb 2024 17:11:48 +0000 (19:11 +0200)] 
Docs: Include doc/examples/11_file_info.c in tarballs.

It was added in 2017 in c2e29f06a7d1e3ba242ac2fafc69f5d6e92f62cd
but it never got into any release tarballs because it was
forgotten to be added to Makefile.am.

(cherry picked from commit dfdb60ffe933a1f1497d300dbb4513ed17ec6f0e)

14 months agoxz: Fix outdated threading related info on the man page.
Lasse Collin [Tue, 13 Feb 2024 09:38:10 +0000 (11:38 +0200)] 
xz: Fix outdated threading related info on the man page.

(cherry picked from commit 0709c2b2d7c1d8f437b003f691880fd7810e5be5)

14 months agoliblzma: Fix compilation of price_tablegen.c.
Lasse Collin [Mon, 12 Feb 2024 15:09:10 +0000 (17:09 +0200)] 
liblzma: Fix compilation of price_tablegen.c.

It is built and run only manually so this didn't matter
unless one wanted to regenerate the price_table.c.

(cherry picked from commit 8e4ec794836bc1701d8c9bd5e347b8ce8cc5bbb4)

14 months agoliblzma: Sync the AUTHORS fix about SHA-256 to lzma.h.
Lasse Collin [Mon, 12 Feb 2024 21:25:54 +0000 (23:25 +0200)] 
liblzma: Sync the AUTHORS fix about SHA-256 to lzma.h.

(based on commit 23de53421ea258cde6a3c33a038b1e9d08f771d1)

14 months agoFix SHA-256 authors.
Lasse Collin [Fri, 9 Feb 2024 15:20:31 +0000 (17:20 +0200)] 
Fix SHA-256 authors.

The initial commit 5d018dc03549c1ee4958364712fb0c94e1bf2741
in 2007 had a comment in sha256.c that the code is based on
Crypto++ Library 5.5.1. In 2009 the Authors list in sha256.c
and the AUTHORS file was updated with information that the
code had come from Crypto++ but via 7-Zip. I know I had viewed
7-Zip's SHA-256 code but back then the C code has been identical
enough with Crypto++, so I don't why I thought the author info
would need that extra step via 7-Zip for this single file.

Another error is that I had mixed sha.* and shacal2.* files
when checking for author info in Crypto++. The shacal2.* files
aren't related to liblzma's sha256.c and thus Kevin Springle's
code in Crypto++ isn't either.

(cherry picked from commit 76946dc4336c831fe2cc26696a035d807dd3cf13)

14 months agoxzless: Use ||- in LESSOPEN with with "less" 451 and newer.
Lasse Collin [Fri, 9 Feb 2024 21:21:01 +0000 (23:21 +0200)] 
xzless: Use ||- in LESSOPEN with with "less" 451 and newer.

(cherry picked from commit 9860d418d296eb3c721e5384fb367c0499b579c8)

14 months agoxzless: Use --show-preproc-errors with "less" 632 and newer.
Lasse Collin [Fri, 9 Feb 2024 21:00:05 +0000 (23:00 +0200)] 
xzless: Use --show-preproc-errors with "less" 632 and newer.

This makes "less" show a warning if a decompression error occurred.

(cherry picked from commit fd0692b0525e6c26b496492be9e2c865cab734f8)

14 months agoBuild: Update visibility.m4 from Gnulib
Lasse Collin [Tue, 7 May 2024 13:21:15 +0000 (16:21 +0300)] 
Build: Update visibility.m4 from Gnulib

This fixes the syntax of the "serial" line and renames
a temporary variable.

18 months agoBump version and soname for 5.4.6. v5.4.6
Jia Tan [Fri, 26 Jan 2024 11:41:20 +0000 (19:41 +0800)] 
Bump version and soname for 5.4.6.

18 months agoAdd NEWS for 5.4.6.
Jia Tan [Fri, 26 Jan 2024 10:54:24 +0000 (18:54 +0800)] 
Add NEWS for 5.4.6.

18 months agoDocs: Update .xz file format specification to 1.2.0.
Jia Tan [Fri, 19 Jan 2024 15:08:14 +0000 (23:08 +0800)] 
Docs: Update .xz file format specification to 1.2.0.

The new RISC-V filter was added to the specification, in addition to
updating the specification URL.

18 months agoxz: Update website URLs in the man pages.
Jia Tan [Fri, 19 Jan 2024 15:08:14 +0000 (23:08 +0800)] 
xz: Update website URLs in the man pages.

18 months agoliblzma: Update website URL.
Jia Tan [Fri, 19 Jan 2024 15:08:14 +0000 (23:08 +0800)] 
liblzma: Update website URL.

18 months agoDocs: Update website URLs.
Jia Tan [Fri, 19 Jan 2024 15:08:14 +0000 (23:08 +0800)] 
Docs: Update website URLs.

18 months agoBuild: Update website URL.
Jia Tan [Fri, 19 Jan 2024 15:08:14 +0000 (23:08 +0800)] 
Build: Update website URL.

19 months agoTranslations: Update the French translation.
Jia Tan [Thu, 21 Dec 2023 13:39:08 +0000 (21:39 +0800)] 
Translations: Update the French translation.

19 months agoxz: Add a comment to Capsicum sandbox setup.
Jia Tan [Thu, 21 Dec 2023 08:39:53 +0000 (16:39 +0800)] 
xz: Add a comment to Capsicum sandbox setup.

This comment is repeated in xzdec.c to help remind us why all the
capabilities are removed from stdin in certain situations.

19 months agoliblzma: Set all values in lzma_lz_encoder to NULL after allocation.
Jia Tan [Sat, 16 Dec 2023 12:51:38 +0000 (20:51 +0800)] 
liblzma: Set all values in lzma_lz_encoder to NULL after allocation.

The first member of lzma_lz_encoder doesn't necessarily need to be set
to NULL since it will always be set before anything tries to use it.
However the function pointer members must be set to NULL since other
functions rely on this NULL value to determine if this behavior is
supported or not.

This fixes a somewhat serious bug, where the options_update() and
set_out_limit() function pointers are not set to NULL. This seems to
have been forgotten since these function pointers were added many years
after the original two (code() and end()).

The problem is that by not setting this to NULL we are relying on the
memory allocation to zero things out if lzma_filters_update() is called
on a LZMA1 encoder. The function pointer for set_out_limit() is less
serious because there is not an API function that could call this in an
incorrect way. set_out_limit() is only called by the MicroLZMA encoder,
which must use LZMA1 where set_out_limit() is always set. Its currently
not possible to call set_out_limit() on an LZMA2 encoder at this time.

So calling lzma_filters_update() on an LZMA1 encoder had undefined
behavior since its possible that memory could be manipulated so the
options_update member pointed to a different instruction sequence.

This is unlikely to be a bug in an existing application since it relies
on calling lzma_filters_update() on an LZMA1 encoder in the first place.
For instance, it does not affect xz because lzma_filters_update() can
only be used when encoding to the .xz format.

19 months agoliblzma: Tweak a comment.
Jia Tan [Sat, 16 Dec 2023 12:30:55 +0000 (20:30 +0800)] 
liblzma: Tweak a comment.

19 months agoliblzma: Make parameter names in function definition match declaration.
Jia Tan [Sat, 16 Dec 2023 12:28:21 +0000 (20:28 +0800)] 
liblzma: Make parameter names in function definition match declaration.

lzma_raw_encoder() and lzma_raw_encoder_init() used "options" as the
parameter name instead of "filters" (used by the declaration). "filters"
is more clear since the parameter represents the list of filters passed
to the raw encoder, each of which contains filter options.

19 months agoliblzma: Improve lzma encoder init function consistency.
Jia Tan [Sat, 16 Dec 2023 12:18:47 +0000 (20:18 +0800)] 
liblzma: Improve lzma encoder init function consistency.

lzma_encoder_init() did not check for NULL options, but
lzma2_encoder_init() did. This is more of a code style improvement than
anything else to help make lzma_encoder_init() and lzma2_encoder_init()
more similar.

19 months agoDocs: Update repository URL in Changelog.
Jia Tan [Sat, 16 Dec 2023 03:20:20 +0000 (11:20 +0800)] 
Docs: Update repository URL in Changelog.

19 months agoTests: Silence -Wsign-conversion warning on GCC version < 10.
Jia Tan [Thu, 7 Dec 2023 13:48:07 +0000 (21:48 +0800)] 
Tests: Silence -Wsign-conversion warning on GCC version < 10.

Since GCC version 10, GCC no longer complains about simple implicit
integer conversions with Arithmetic operators.

For instance:

    uint8_t a = 5;
    uint32_t b = a + 5;

Give a warning on GCC 9 and earlier but this:

    uint8_t a = 5;
    uint32_t b = (a + 5) * 2;

Gives a warning with GCC 10+.

19 months agoUpdate THANKS.
Jia Tan [Thu, 30 Nov 2023 15:10:43 +0000 (23:10 +0800)] 
Update THANKS.

19 months agoTests: Fix typos
Kian-Meng Ang [Thu, 30 Nov 2023 15:01:19 +0000 (23:01 +0800)] 
Tests: Fix typos

19 months agoxz: Use is_tty() in message.c.
Jia Tan [Thu, 23 Nov 2023 14:13:39 +0000 (22:13 +0800)] 
xz: Use is_tty() in message.c.

19 months agoxz: Create separate is_tty() function.
Jia Tan [Thu, 23 Nov 2023 14:04:35 +0000 (22:04 +0800)] 
xz: Create separate is_tty() function.

The new is_tty() will report if a file descriptor is a terminal or not.
On POSIX systems, it is a wrapper around isatty(). However, the native
Windows implementation of isatty() will return true for all character
devices, not just terminals. So is_tty() has a special case for Windows
so it can use alternative Windows API functions to determine if a file
descriptor is a terminal.

This fixes a bug with MSVC and MinGW-w64 builds that refused to read from
or write to non-terminal character devices because xz thought it was a
terminal. For instance:

    xz foo -c > /dev/null

would fail because /dev/null was assumed to be a terminal.

19 months agotuklib_integer: Fix typo discovered by codespell.
Jia Tan [Wed, 22 Nov 2023 12:39:41 +0000 (20:39 +0800)] 
tuklib_integer: Fix typo discovered by codespell.

Based on internet dictionary searches, 'choise' is an outdated spelling
of 'choice'.

19 months agoTests: Fix typo in a comment.
Jia Tan [Fri, 17 Nov 2023 12:04:58 +0000 (20:04 +0800)] 
Tests: Fix typo in a comment.

19 months agoTests: Create test_suffix.sh.
Jia Tan [Fri, 17 Nov 2023 12:35:11 +0000 (20:35 +0800)] 
Tests: Create test_suffix.sh.

This tests some complicated interactions with the --suffix= option.
The suffix option must be used with --format=raw, but can optionally
be used to override the default .xz suffix.

This test also verifies some recent bugs have been correctly solved
and to hopefully avoid further regressions in the future.

19 months agoxz: Fix suffix check.
Jia Tan [Tue, 14 Nov 2023 12:27:04 +0000 (20:27 +0800)] 
xz: Fix suffix check.

The suffix refactor done in 99575947a58a60416c570eb78038d18a1ea4cef4
had a small regression where raw format compression to standard out
failed if a suffix was not set. In this case, setting the suffix did
not make sense since a file is not created.

Now, xz should only fail when a suffix is not provided when it is
actually needed.

For instance:

    echo "foo" | xz --format=raw --lzma2 | wc -c

does not need a suffix check since it creates no files. But:

    xz --format=raw --lzma2 --suffix=.bar foo

Needs the suffix to be set since it must create foo.bar.