summaryrefslogtreecommitdiffstats
path: root/pkgs/tools/archivers
diff options
context:
space:
mode:
authorBenjamin Hipple <bhipple@protonmail.com>2018-08-16 01:52:30 +0000
committerBenjamin Hipple <bhipple@protonmail.com>2018-08-16 01:52:30 +0000
commit0c119682cef99e25e99fc23018ef28c3af461c95 (patch)
treeb1fdcf4738097fbbb418c1d90f2ad3c84ebd22f4 /pkgs/tools/archivers
parentd5e496a2bba1276997463852f02e842eb52f22c4 (diff)
p7zip: vendor debian patches
A few months ago I moved these patches to the new debian alsa instance [1], but it looks like their `sha256`s on the tag at the remote have changed again. It doesn't appear that debian's source remote is stable in the way we need it to be; let's just vendor the patches to avoid future issues. [1] https://github.com/NixOS/nixpkgs/pull/41769
Diffstat (limited to 'pkgs/tools/archivers')
-rw-r--r--pkgs/tools/archivers/p7zip/12-CVE-2016-9296.patch23
-rw-r--r--pkgs/tools/archivers/p7zip/13-CVE-2017-17969.patch35
-rw-r--r--pkgs/tools/archivers/p7zip/default.nix14
3 files changed, 61 insertions, 11 deletions
diff --git a/pkgs/tools/archivers/p7zip/12-CVE-2016-9296.patch b/pkgs/tools/archivers/p7zip/12-CVE-2016-9296.patch
new file mode 100644
index 000000000000..42245c92c0aa
--- /dev/null
+++ b/pkgs/tools/archivers/p7zip/12-CVE-2016-9296.patch
@@ -0,0 +1,23 @@
+From: Robert Luberda <robert@debian.org>
+Date: Sat, 19 Nov 2016 08:48:08 +0100
+Subject: Fix nullptr dereference (CVE-2016-9296)
+
+Patch taken from https://sourceforge.net/p/p7zip/bugs/185/
+---
+ CPP/7zip/Archive/7z/7zIn.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/CPP/7zip/Archive/7z/7zIn.cpp b/CPP/7zip/Archive/7z/7zIn.cpp
+index b0c6b98..7c6dde2 100644
+--- a/CPP/7zip/Archive/7z/7zIn.cpp
++++ b/CPP/7zip/Archive/7z/7zIn.cpp
+@@ -1097,7 +1097,8 @@ HRESULT CInArchive::ReadAndDecodePackedStreams(
+ if (CrcCalc(data, unpackSize) != folders.FolderCRCs.Vals[i])
+ ThrowIncorrect();
+ }
+- HeadersSize += folders.PackPositions[folders.NumPackStreams];
++ if (folders.PackPositions)
++ HeadersSize += folders.PackPositions[folders.NumPackStreams];
+ return S_OK;
+ }
+
diff --git a/pkgs/tools/archivers/p7zip/13-CVE-2017-17969.patch b/pkgs/tools/archivers/p7zip/13-CVE-2017-17969.patch
new file mode 100644
index 000000000000..a9787c4a9088
--- /dev/null
+++ b/pkgs/tools/archivers/p7zip/13-CVE-2017-17969.patch
@@ -0,0 +1,35 @@
+From: =?utf-8?q?Antoine_Beaupr=C3=A9?= <anarcat@debian.org>
+Date: Fri, 2 Feb 2018 11:11:41 +0100
+Subject: Heap-based buffer overflow in 7zip/Compress/ShrinkDecoder.cpp
+
+Origin: vendor, https://sourceforge.net/p/p7zip/bugs/_discuss/thread/0920f369/27d7/attachment/CVE-2017-17969.patch
+Forwarded: https://sourceforge.net/p/p7zip/bugs/_discuss/thread/0920f369/#27d7
+Bug: https://sourceforge.net/p/p7zip/bugs/204/
+Bug-Debian: https://bugs.debian.org/888297
+Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-17969
+Reviewed-by: Salvatore Bonaccorso <carnil@debian.org>
+Last-Update: 2018-02-01
+Applied-Upstream: 18.00-beta
+---
+ CPP/7zip/Compress/ShrinkDecoder.cpp | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/CPP/7zip/Compress/ShrinkDecoder.cpp b/CPP/7zip/Compress/ShrinkDecoder.cpp
+index 80b7e67..ca37764 100644
+--- a/CPP/7zip/Compress/ShrinkDecoder.cpp
++++ b/CPP/7zip/Compress/ShrinkDecoder.cpp
+@@ -121,8 +121,13 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
+ {
+ _stack[i++] = _suffixes[cur];
+ cur = _parents[cur];
++ if (cur >= kNumItems || i >= kNumItems)
++ break;
+ }
+-
++
++ if (cur >= kNumItems || i >= kNumItems)
++ break;
++
+ _stack[i++] = (Byte)cur;
+ lastChar2 = (Byte)cur;
+
diff --git a/pkgs/tools/archivers/p7zip/default.nix b/pkgs/tools/archivers/p7zip/default.nix
index 4d8b2477ed58..4886217211df 100644
--- a/pkgs/tools/archivers/p7zip/default.nix
+++ b/pkgs/tools/archivers/p7zip/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch }:
+{ stdenv, fetchurl }:
stdenv.mkDerivation rec {
name = "p7zip-${version}";
@@ -10,16 +10,8 @@ stdenv.mkDerivation rec {
};
patches = [
- (fetchpatch rec {
- name = "CVE-2016-9296.patch";
- url = "https://salsa.debian.org/debian/p7zip/raw/debian/${version}+dfsg-6/debian/patches/12-${name}";
- sha256 = "09wbkzai46bwm8zmplsz0m4jck3qn7snr68i9p1gsih300zidj0m";
- })
- (fetchpatch rec {
- name = "CVE-2017-17969.patch";
- url = "https://salsa.debian.org/debian/p7zip/raw/debian/${version}+dfsg-6/debian/patches/13-${name}";
- sha256 = "00pycdwx6gw7w591bg54ym6zhbxgn47p3zhms6mnmaycfzw09mkn";
- })
+ ./12-CVE-2016-9296.patch
+ ./13-CVE-2017-17969.patch
];
# Default makefile is full of impurities on Darwin. The patch doesn't hurt Linux so I'm leaving it unconditional