From 1ceea34d30867baa8db6278ac76cc076729605b6 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Sat, 1 Apr 2023 23:42:45 -0500
Subject: system/xz: Update to 5.4.2

---
 system/xz/APKBUILD                                 | 12 +--
 system/xz/CVE-2022-1271-xzgrep-ZDI-CAN-16587.patch | 94 ----------------------
 system/xz/dont-use-libdir-for-pkgconfig.patch      |  8 +-
 3 files changed, 8 insertions(+), 106 deletions(-)
 delete mode 100644 system/xz/CVE-2022-1271-xzgrep-ZDI-CAN-16587.patch

(limited to 'system')

diff --git a/system/xz/APKBUILD b/system/xz/APKBUILD
index 7b8861fca..0b52b0f85 100644
--- a/system/xz/APKBUILD
+++ b/system/xz/APKBUILD
@@ -1,8 +1,8 @@
 # Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
 # Maintainer: Dan Theisen <djt@hxx.in>
 pkgname=xz
-pkgver=5.2.5
-pkgrel=1
+pkgver=5.4.2
+pkgrel=0
 pkgdesc="Library and command line tools for XZ and LZMA compressed files"
 url="https://tukaani.org/xz/"
 arch="all"
@@ -12,7 +12,6 @@ makedepends=""
 subpackages="$pkgname-doc $pkgname-dev $pkgname-lang $pkgname-libs"
 source="https://tukaani.org/xz/xz-$pkgver.tar.gz
 	dont-use-libdir-for-pkgconfig.patch
-	CVE-2022-1271-xzgrep-ZDI-CAN-16587.patch
 	"
 
 build() {
@@ -30,8 +29,6 @@ build() {
 
 	sed 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
 		-i libtool
-	sed 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
-		-i libtool
 
 	make
 }
@@ -46,6 +43,5 @@ package() {
 		"$pkgdir"/usr/share/licenses/$pkgname
 }
 
-sha512sums="7443674247deda2935220fbc4dfc7665e5bb5a260be8ad858c8bd7d7b9f0f868f04ea45e62eb17c0a5e6a2de7c7500ad2d201e2d668c48ca29bd9eea5a73a3ce  xz-5.2.5.tar.gz
-9310ae2568dd6ac474e3cb9895e1339ca2dbe8834f856edbb7d2264c0019bde4bbd94aa1edd34e5c8d0aed1f35a1877b0e053ed08a270835ea81e59c7be5edb3  dont-use-libdir-for-pkgconfig.patch
-52b16268e333399444f433a11ccf3a9b020a6914ed23fc8e082128fec596011d7c6863d47414d4c0f245d20ebed4b3a50b422599b4b88d66f6c6eb2e74b9a939  CVE-2022-1271-xzgrep-ZDI-CAN-16587.patch"
+sha512sums="149f980338bea3d66de1ff5994b2b236ae1773135eda68b62b009df0c9dcdf5467f8cb2c06da95a71b6556d60bd3d21f475feced34d5dfdb80ee95416a2f9737  xz-5.4.2.tar.gz
+54bbe1f8aae954d2550941f69a509e210d0f6bee2393494dcf445a14d14046953c125177b4cc9fa79ec55b81379dfe4ae0187f106abd2f3cc4331782a5c0b4fd  dont-use-libdir-for-pkgconfig.patch"
diff --git a/system/xz/CVE-2022-1271-xzgrep-ZDI-CAN-16587.patch b/system/xz/CVE-2022-1271-xzgrep-ZDI-CAN-16587.patch
deleted file mode 100644
index 406ded590..000000000
--- a/system/xz/CVE-2022-1271-xzgrep-ZDI-CAN-16587.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-From 69d1b3fc29677af8ade8dc15dba83f0589cb63d6 Mon Sep 17 00:00:00 2001
-From: Lasse Collin <lasse.collin@tukaani.org>
-Date: Tue, 29 Mar 2022 19:19:12 +0300
-Subject: [PATCH] xzgrep: Fix escaping of malicious filenames (ZDI-CAN-16587).
-
-Malicious filenames can make xzgrep to write to arbitrary files
-or (with a GNU sed extension) lead to arbitrary code execution.
-
-xzgrep from XZ Utils versions up to and including 5.2.5 are
-affected. 5.3.1alpha and 5.3.2alpha are affected as well.
-This patch works for all of them.
-
-This bug was inherited from gzip's zgrep. gzip 1.12 includes
-a fix for zgrep.
-
-The issue with the old sed script is that with multiple newlines,
-the N-command will read the second line of input, then the
-s-commands will be skipped because it's not the end of the
-file yet, then a new sed cycle starts and the pattern space
-is printed and emptied. So only the last line or two get escaped.
-
-One way to fix this would be to read all lines into the pattern
-space first. However, the included fix is even simpler: All lines
-except the last line get a backslash appended at the end. To ensure
-that shell command substitution doesn't eat a possible trailing
-newline, a colon is appended to the filename before escaping.
-The colon is later used to separate the filename from the grep
-output so it is fine to add it here instead of a few lines later.
-
-The old code also wasn't POSIX compliant as it used \n in the
-replacement section of the s-command. Using \<newline> is the
-POSIX compatible method.
-
-LC_ALL=C was added to the two critical sed commands. POSIX sed
-manual recommends it when using sed to manipulate pathnames
-because in other locales invalid multibyte sequences might
-cause issues with some sed implementations. In case of GNU sed,
-these particular sed scripts wouldn't have such problems but some
-other scripts could have, see:
-
-    info '(sed)Locale Considerations'
-
-This vulnerability was discovered by:
-cleemy desu wayo working with Trend Micro Zero Day Initiative
-
-Thanks to Jim Meyering and Paul Eggert discussing the different
-ways to fix this and for coordinating the patch release schedule
-with gzip.
----
- src/scripts/xzgrep.in | 20 ++++++++++++--------
- 1 file changed, 12 insertions(+), 8 deletions(-)
-
-diff --git a/src/scripts/xzgrep.in b/src/scripts/xzgrep.in
-index b180936..e5186ba 100644
---- a/src/scripts/xzgrep.in
-+++ b/src/scripts/xzgrep.in
-@@ -180,22 +180,26 @@ for i; do
-          { test $# -eq 1 || test $no_filename -eq 1; }; then
-       eval "$grep"
-     else
-+      # Append a colon so that the last character will never be a newline
-+      # which would otherwise get lost in shell command substitution.
-+      i="$i:"
-+
-+      # Escape & \ | and newlines only if such characters are present
-+      # (speed optimization).
-       case $i in
-       (*'
- '* | *'&'* | *'\'* | *'|'*)
--        i=$(printf '%s\n' "$i" |
--            sed '
--              $!N
--              $s/[&\|]/\\&/g
--              $s/\n/\\n/g
--            ');;
-+        i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/');;
-       esac
--      sed_script="s|^|$i:|"
-+
-+      # $i already ends with a colon so don't add it here.
-+      sed_script="s|^|$i|"
- 
-       # Fail if grep or sed fails.
-       r=$(
-         exec 4>&1
--        (eval "$grep" 4>&-; echo $? >&4) 3>&- | sed "$sed_script" >&3 4>&-
-+        (eval "$grep" 4>&-; echo $? >&4) 3>&- |
-+            LC_ALL=C sed "$sed_script" >&3 4>&-
-       ) || r=2
-       exit $r
-     fi >&3 5>&-
--- 
-2.35.1
-
diff --git a/system/xz/dont-use-libdir-for-pkgconfig.patch b/system/xz/dont-use-libdir-for-pkgconfig.patch
index dbf4d5927..c6b1c480c 100644
--- a/system/xz/dont-use-libdir-for-pkgconfig.patch
+++ b/system/xz/dont-use-libdir-for-pkgconfig.patch
@@ -1,6 +1,6 @@
 --- xz-5.2.4/src/liblzma/Makefile.am.old	2018-04-29 15:16:04.000000000 +0000
 +++ xz-5.2.4/src/liblzma/Makefile.am	2018-07-19 02:18:19.010000000 +0000
-@@ -97,7 +97,7 @@
+@@ -101,7 +101,7 @@
  
  
  ## pkg-config
@@ -11,10 +11,10 @@
  
 --- xz-5.2.4/src/liblzma/Makefile.in.old	2018-04-29 16:01:26.000000000 +0000
 +++ xz-5.2.4/src/liblzma/Makefile.in	2018-07-19 02:18:33.600000000 +0000
-@@ -752,7 +752,7 @@
+@@ -879,7 +879,7 @@
  
- liblzma_la_LDFLAGS = -no-undefined -version-info 7:4:2 $(am__append_1) \
- 	$(am__append_42)
+ liblzma_la_LDFLAGS = -no-undefined -version-info 9:2:4 $(am__append_1) \
+ 	$(am__append_2) $(am__append_48)
 -pkgconfigdir = $(libdir)/pkgconfig
 +pkgconfigdir = /usr/lib/pkgconfig
  pkgconfig_DATA = liblzma.pc
-- 
cgit v1.2.3-70-g09d2