mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-04 14:00:04 +00:00
There is no CVE assigned yet. See: https://security-tracker.debian.org/tracker/TEMP-1143866-6DBA82
114 lines
4.4 KiB
Nix
114 lines
4.4 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchurl,
|
|
enableNLS ? false,
|
|
libnatspec ? null,
|
|
libiconv,
|
|
fetchpatch,
|
|
fetchDebianPatch,
|
|
}:
|
|
|
|
assert enableNLS -> libnatspec != null;
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "zip";
|
|
version = "3.0";
|
|
|
|
src = fetchurl {
|
|
urls = [
|
|
"ftp://ftp.info-zip.org/pub/infozip/src/zip${
|
|
lib.replaceStrings [ "." ] [ "" ] finalAttrs.version
|
|
}.tgz"
|
|
"https://src.fedoraproject.org/repo/pkgs/zip/zip30.tar.gz/7b74551e63f8ee6aab6fbc86676c0d37/zip30.tar.gz"
|
|
];
|
|
sha256 = "0sb3h3067pzf3a7mlxn1hikpcjrsvycjcnj9hl9b1c3ykcgvps7h";
|
|
};
|
|
|
|
postPatch = ''
|
|
substituteInPlace unix/Makefile --replace 'CC = cc' ""
|
|
substituteInPlace unix/configure --replace-fail "O3" "O2"
|
|
'';
|
|
|
|
makefile = "unix/Makefile";
|
|
buildFlags = if stdenv.hostPlatform.isCygwin then [ "cygwin" ] else [ "generic" ];
|
|
installFlags = [
|
|
"prefix=${placeholder "out"}"
|
|
"INSTALL=cp"
|
|
];
|
|
|
|
patches = [
|
|
# Implicit declaration of `closedir` and `opendir` cause dirent detection to fail with clang 16.
|
|
./fix-implicit-declarations.patch
|
|
# Fixes forward declaration errors with timezone.c
|
|
./fix-time.h-not-included.patch
|
|
# Without this patch, we get a runtime failures with GCC 14 when building OpenJDK 8:
|
|
#
|
|
# zip I/O error: No such file or directory
|
|
# zip error: Could not create output file (was replacing the original zip file)
|
|
# make[2]: *** [CreateJars.gmk:659: /build/source/build/linux-x86_64-normal-server-release/images/src.zip] Error 1
|
|
(fetchDebianPatch {
|
|
inherit (finalAttrs) pname version;
|
|
debianRevision = "16";
|
|
patch = "fix-build-with-gcc-14.patch";
|
|
hash = "sha256-C966AdPV5E44cJ1L28iFvmXq3frjNiW6PoHiOOusS04=";
|
|
})
|
|
(fetchpatch {
|
|
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/zip/files/zip-3.0-pic.patch?id=d37d095fc7a2a9e4a8e904a7bf0f597fe99df85a";
|
|
hash = "sha256-OXgC9KqiOpH/o/bSabt3LqtoT/xifqfkvpLLPfPz+1c=";
|
|
})
|
|
(fetchpatch {
|
|
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/zip/files/zip-3.0-no-crypt.patch?id=d37d095fc7a2a9e4a8e904a7bf0f597fe99df85a";
|
|
hash = "sha256-9bwV+uKST828PcRVbICs8xwz9jcIPk26gxLBbiEeta4=";
|
|
})
|
|
(fetchpatch {
|
|
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/zip/files/zip-3.0-format-security.patch?id=d37d095fc7a2a9e4a8e904a7bf0f597fe99df85a";
|
|
hash = "sha256-YmGKivZ0iFCFmPjVYuOv9D8Y0xG2QnWOpas8gMgoQ3M=";
|
|
})
|
|
(fetchpatch {
|
|
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/zip/files/zip-3.0-exec-stack.patch?id=d37d095fc7a2a9e4a8e904a7bf0f597fe99df85a";
|
|
hash = "sha256-akJFY+zGijPWCwaAL/xxCN4wQpVFBHkLMo2HowrSn/M=";
|
|
})
|
|
(fetchpatch {
|
|
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/zip/files/zip-3.0-build.patch?id=d37d095fc7a2a9e4a8e904a7bf0f597fe99df85a";
|
|
hash = "sha256-MiupD7W+sxiRTsB5viKAiI4QeqtZC6VttfJktdt1ucI=";
|
|
})
|
|
# Buffer overflow on Unicode characters in path names
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=2165653
|
|
# (included among other changes below)
|
|
(fetchpatch {
|
|
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-arch/zip/files/zip-3.0-zipnote-freeze.patch?id=d37d095fc7a2a9e4a8e904a7bf0f597fe99df85a";
|
|
hash = "sha256-EVr7YS3IytnCRjAYUlkg05GA/kaAY9NRFG7uDt0QLAY=";
|
|
})
|
|
# Fix buffer overflow (CVE-2018-13410).
|
|
# See: https://seclists.org/fulldisclosure/2018/Jul/24
|
|
(fetchDebianPatch {
|
|
inherit (finalAttrs) pname version;
|
|
debianRevision = "16";
|
|
patch = "buffer-overflow-cve-2018-13410.patch";
|
|
hash = "sha256-Hgy0yrBuSX2XWN1PNASQbjiXfyzSScwHQ+o0fv6Sgs4=";
|
|
})
|
|
# Command injection in zip -T for specially crafted file
|
|
# names. See: https://seclists.org/oss-sec/2026/q3/494
|
|
(fetchDebianPatch {
|
|
inherit (finalAttrs) pname version;
|
|
debianRevision = "16";
|
|
patch = "fix-command-injection.patch";
|
|
hash = "sha256-cfE98l98KkPfDS5KT/DB2bqFNPTbHBKyJ7W2+iKgaGI=";
|
|
})
|
|
]
|
|
++ lib.optionals (enableNLS && !stdenv.hostPlatform.isCygwin) [ ./natspec-gentoo.patch.bz2 ];
|
|
|
|
buildInputs =
|
|
lib.optional enableNLS libnatspec ++ lib.optional stdenv.hostPlatform.isCygwin libiconv;
|
|
|
|
meta = {
|
|
description = "Compressor/archiver for creating and modifying zipfiles";
|
|
homepage = "http://www.info-zip.org";
|
|
license = lib.licenses.bsdOriginal;
|
|
platforms = lib.platforms.all;
|
|
maintainers = with lib.maintainers; [ RossComputerGuy ];
|
|
mainProgram = "zip";
|
|
};
|
|
})
|