From bad888fe343c52c5b6e2c449034a4de41840f1bf Mon Sep 17 00:00:00 2001 From: Reilly Brogan Date: Wed, 27 Apr 2022 11:26:48 +0200 Subject: [PATCH] zlib: Add crc patch Summary: Fixes a CPU-dependent issue that breaks Maven builds (Zlib issue: https://github.com/madler/zlib/issues/613) Test Plan: - Rebuilt a few revdeps - Tested to see if build error was still present (I encountered the linked issue) and it wasn't Reviewers: #triage_team, Girtablulu Reviewed By: #triage_team, Girtablulu Subscribers: Girtablulu Differential Revision: https://dev.getsol.us/D13176 --- files/correct-incorrect-inputs-crc.patch | 51 ++++++++++++++++++++++++ package.yml | 3 +- pspec_x86_64.xml | 24 +++++------ 3 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 files/correct-incorrect-inputs-crc.patch diff --git a/files/correct-incorrect-inputs-crc.patch b/files/correct-incorrect-inputs-crc.patch new file mode 100644 index 0000000..85a6a7e --- /dev/null +++ b/files/correct-incorrect-inputs-crc.patch @@ -0,0 +1,51 @@ +From ec3df00224d4b396e2ac6586ab5d25f673caa4c2 Mon Sep 17 00:00:00 2001 +From: Mark Adler +Date: Wed, 30 Mar 2022 11:14:53 -0700 +Subject: [PATCH] Correct incorrect inputs provided to the CRC functions. + +The previous releases of zlib were not sensitive to incorrect CRC +inputs with bits set above the low 32. This commit restores that +behavior, so that applications with such bugs will continue to +operate as before. +--- + crc32.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/crc32.c b/crc32.c +index a1bdce5c2..451887bc7 100644 +--- a/crc32.c ++++ b/crc32.c +@@ -630,7 +630,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) + #endif /* DYNAMIC_CRC_TABLE */ + + /* Pre-condition the CRC */ +- crc ^= 0xffffffff; ++ crc = (~crc) & 0xffffffff; + + /* Compute the CRC up to a word boundary. */ + while (len && ((z_size_t)buf & 7) != 0) { +@@ -749,7 +749,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) + #endif /* DYNAMIC_CRC_TABLE */ + + /* Pre-condition the CRC */ +- crc ^= 0xffffffff; ++ crc = (~crc) & 0xffffffff; + + #ifdef W + +@@ -1077,7 +1077,7 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2) + #ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); + #endif /* DYNAMIC_CRC_TABLE */ +- return multmodp(x2nmodp(len2, 3), crc1) ^ crc2; ++ return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff); + } + + /* ========================================================================= */ +@@ -1112,5 +1112,5 @@ uLong crc32_combine_op(crc1, crc2, op) + uLong crc2; + uLong op; + { +- return multmodp(op, crc1) ^ crc2; ++ return multmodp(op, crc1) ^ (crc2 & 0xffffffff); + } diff --git a/package.yml b/package.yml index 4ac4b66..98590b0 100644 --- a/package.yml +++ b/package.yml @@ -1,6 +1,6 @@ name : zlib version : 1.2.12 -release : 22 +release : 23 source : - https://github.com/madler/zlib/archive/refs/tags/v1.2.12.tar.gz : d8688496ea40fb61787500e863cc63c9afcbc524468cedeb478068924eb54932 homepage : http://www.zlib.net @@ -30,6 +30,7 @@ patterns : setup : | %patch -p1 < $pkgfiles/no_ldconfig.patch %patch -p1 < $pkgfiles/fix-cc-configure-issue.patch + %patch -p1 < $pkgfiles/correct-incorrect-inputs-crc.patch ./configure --prefix=/usr --libdir=%libdir% diff --git a/pspec_x86_64.xml b/pspec_x86_64.xml index 7967ddb..a58464c 100644 --- a/pspec_x86_64.xml +++ b/pspec_x86_64.xml @@ -3,8 +3,8 @@ zlib http://www.zlib.net - Joey Riches - josephriches@gmail.com + Reilly Brogan + solus@reillybrogan.com ZLIB system.base @@ -29,7 +29,7 @@ The zlib library is a compression library that aims to be unobtrusive. emul32 - zlib + zlib /usr/lib32/libz.so.1 @@ -42,8 +42,8 @@ The zlib library is a compression library that aims to be unobtrusive. programming.devel - zlib-devel - zlib-32bit + zlib-devel + zlib-32bit /usr/lib32/libz.a @@ -57,7 +57,7 @@ The zlib library is a compression library that aims to be unobtrusive. system.devel - zlib + zlib /usr/include/zconf.h @@ -73,7 +73,7 @@ Mini zip and unzip based on zlib system.utils - zlib + zlib /usr/lib64/libminizip.so.1 @@ -86,7 +86,7 @@ Mini zip and unzip based on zlib programming.devel - zlib-minizip + zlib-minizip /usr/include/minizip/crypt.h @@ -100,12 +100,12 @@ - - 2022-04-12 + + 2022-04-25 1.2.12 Packaging update - Joey Riches - josephriches@gmail.com + Reilly Brogan + solus@reillybrogan.com \ No newline at end of file