Skip to content

Commit

Permalink
Update contrib/libs/lzma to 5.6.4
Browse files Browse the repository at this point in the history
commit_hash:509ecf098c2bdb4bf7273b95ff459ee74bd2a6bf
  • Loading branch information
robot-piglet committed Feb 10, 2025
1 parent 167bede commit ef7b180
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 17 deletions.
49 changes: 48 additions & 1 deletion contrib/libs/lzma/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,56 @@
XZ Utils Release Notes
======================

5.6.4 (2025-01-23)

* liblzma: Fix LZMA/LZMA2 encoder on big endian ARM64.

* xz:

- Fix --filters= and --filters1= ... --filters9= options
parsing. They require an argument, thus "xz --filters lzma2"
should work in addition to "xz --filters=lzma2".

- On the man page, note in the --compress and --decompress
options that the default behavior is to delete the input
file unless writing to standard output. It was already
documented in the DESCRIPTION section but new users in
a hurry might miss it.

* Windows (native builds, not Cygwin): Fix regressions introduced
in XZ Utils 5.6.3 which caused non-ASCII characters to display
incorrectly. Only builds with translation support were affected
(--enable-nls or ENABLE_NLS=ON). The following changes affect
builds that have translations enabled:

- Require UCRT because MSVCRT doesn't support UTF-8
locales and thus translations won't be readable on
Windows 10 version 1903 and later. (MSVCRT builds
are still possible with --disable-nls or ENABLE_NLS=OFF.)

- Require gettext-runtime >= 0.23.1 because older versions
don't autodetect the use of the UTF-8 code page. This
resulted in garbled non-ASCII characters even with UCRT.

- Partially fix alignment issues in xz --verbose --list
with translated messages. Chinese (simplified),
Chinese (traditional), and Korean column headings
are misaligned still because Windows and MinGW-w64
don't provide wcwidth() and XZ Utils doesn't include
a replacement function either.

* CMake: Explicitly disable unity builds. This prevents build
failures when another project uses XZ Utils via CMake's
FetchContent module, and that project enables unity builds.

* Update Chinese (traditional) and Serbian translations.


5.6.3 (2024-10-01)

IMPORTANT: This includes a Windows-specific security fix to
the command line tools. liblzma isn't affected by this issue.
the command line tools (CVE-2024-47611). liblzma isn't affected
by this issue.

* liblzma:

Expand Down Expand Up @@ -55,6 +101,7 @@ XZ Utils Release Notes
which can be exploited with malicious filenames to do
argument injection or directory traversal attacks.
UTF-8 avoids best-fit mappings and thus fixes the issue.
(CVE-2024-47611)

Forcing the process code page to UTF-8 is possible only
on Windows 10 version 1903 and later. The command line
Expand Down
30 changes: 21 additions & 9 deletions contrib/libs/lzma/common/sysdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,29 @@
# include <config.h>
#endif

// This #define ensures that C99 and POSIX compliant stdio functions are
// available with MinGW-w64 (both 32-bit and 64-bit). Modern MinGW-w64 adds
// this automatically, for example, when the compiler is in C99 (or later)
// mode when building against msvcrt.dll. It still doesn't hurt to be explicit
// that we always want this and #define this unconditionally.
// Choose if MinGW-w64's stdio replacement functions should be used.
// The default has varied slightly in the past so it's clearest to always
// set it explicitly.
//
// With Universal CRT (UCRT) this is less important because UCRT contains
// C99-compatible stdio functions. It's still nice to #define this as UCRT
// doesn't support the POSIX thousand separator flag in printf (like "%'u").
#ifdef __MINGW32__
// Modern MinGW-w64 enables the replacement functions even with UCRT
// when _GNU_SOURCE is defined. That's good because UCRT doesn't support
// the POSIX thousand separator flag in printf (like "%'u"). Otherwise
// XZ Utils works with the UCRT stdio functions.
//
// The replacement functions add over 20 KiB to each executable. For
// size-optimized builds (HAVE_SMALL), disable the replacements.
// Then thousand separators aren't shown in xz's messages but this is
// a minor downside compare to the slower speed of the HAVE_SMALL builds.
//
// The legacy MSVCRT is pre-C99 and it's best to always use the stdio
// replacements functions from MinGW-w64.
#if defined(__MINGW32__) && !defined(__USE_MINGW_ANSI_STDIO)
# define __USE_MINGW_ANSI_STDIO 1
# include <_mingw.h>
# if defined(_UCRT) && defined(HAVE_SMALL)
# undef __USE_MINGW_ANSI_STDIO
# define __USE_MINGW_ANSI_STDIO 0
# endif
#endif

// size_t and NULL
Expand Down
2 changes: 1 addition & 1 deletion contrib/libs/lzma/liblzma/api/lzma/lzma12.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ typedef struct {
*
* ext_size_low holds the least significant 32 bits of the
* uncompressed size. The most significant 32 bits must be set
* in ext_size_high. The macro lzma_ext_size_set(opt_lzma, u64size)
* in ext_size_high. The macro lzma_set_ext_size(opt_lzma, u64size)
* can be used to set these members.
*
* The 64-bit uncompressed size is split into two uint32_t variables
Expand Down
2 changes: 1 addition & 1 deletion contrib/libs/lzma/liblzma/api/lzma/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define LZMA_VERSION_MINOR 6

/** \brief Patch version number of the liblzma release. */
#define LZMA_VERSION_PATCH 3
#define LZMA_VERSION_PATCH 4

/**
* \brief Version stability marker
Expand Down
9 changes: 7 additions & 2 deletions contrib/libs/lzma/liblzma/common/memcmplen.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2,
|| (defined(_MSC_VER) && (defined(_M_X64) \
|| defined(_M_ARM64) || defined(_M_ARM64EC))))
// This is only for x86-64 and ARM64 for now. This might be fine on
// other 64-bit processors too. On big endian one should use xor
// instead of subtraction and switch to __builtin_clzll().
// other 64-bit processors too.
//
// Reasons to use subtraction instead of xor:
//
Expand All @@ -82,14 +81,20 @@ lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2,
// version 2023-05-26. https://www.agner.org/optimize/
#define LZMA_MEMCMPLEN_EXTRA 8
while (len < limit) {
# ifdef WORDS_BIGENDIAN
const uint64_t x = read64ne(buf1 + len) ^ read64ne(buf2 + len);
# else
const uint64_t x = read64ne(buf1 + len) - read64ne(buf2 + len);
# endif
if (x != 0) {
// MSVC or Intel C compiler on Windows
# if defined(_MSC_VER) || defined(__INTEL_COMPILER)
unsigned long tmp;
_BitScanForward64(&tmp, x);
len += (uint32_t)tmp >> 3;
// GCC, Clang, or Intel C compiler
# elif defined(WORDS_BIGENDIAN)
len += (uint32_t)__builtin_clzll(x) >> 3;
# else
len += (uint32_t)__builtin_ctzll(x) >> 3;
# endif
Expand Down
4 changes: 4 additions & 0 deletions contrib/libs/lzma/liblzma/common/string_conversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@ parse_lzma12_preset(const char **const str, const char *str_end,
uint32_t *preset)
{
assert(*str < str_end);

if (!(**str >= '0' && **str <= '9'))
return "Unsupported preset";

*preset = (uint32_t)(**str - '0');

// NOTE: Remember to update LZMA12_PRESET_STR if this is modified!
Expand Down
2 changes: 1 addition & 1 deletion contrib/libs/lzma/liblzma/lzma/lzma_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

// The macros unroll loops with switch statements.
// Silence warnings about missing fall-through comments.
#if TUKLIB_GNUC_REQ(7, 0)
#if TUKLIB_GNUC_REQ(7, 0) || defined(__clang__)
# pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif

Expand Down
4 changes: 2 additions & 2 deletions contrib/libs/lzma/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ LICENSE(

LICENSE_TEXTS(.yandex_meta/licenses.list.txt)

VERSION(5.6.3)
VERSION(5.6.4)

ORIGINAL_SOURCE(https://github.com/tukaani-project/xz/archive/v5.6.3.tar.gz)
ORIGINAL_SOURCE(https://github.com/tukaani-project/xz/archive/v5.6.4.tar.gz)

ADDINCL(
GLOBAL contrib/libs/lzma/liblzma/api
Expand Down

0 comments on commit ef7b180

Please sign in to comment.