From fe72329821805ad59a0977214e39edf77c1b86da Mon Sep 17 00:00:00 2001 From: Jacalz Date: Wed, 23 Dec 2020 12:47:30 +0100 Subject: [PATCH 1/2] Switch zip handling to use github.com/klauspost/compress/zip This improves the performence over teh stdlib implementation. --- zip.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip.go b/zip.go index 81694bdc..8a552017 100644 --- a/zip.go +++ b/zip.go @@ -1,7 +1,6 @@ package archiver import ( - "archive/zip" "bytes" "compress/flate" "fmt" @@ -14,6 +13,7 @@ import ( "strings" "github.com/dsnet/compress/bzip2" + "github.com/klauspost/compress/zip" "github.com/klauspost/compress/zstd" "github.com/ulikunitz/xz" ) From aab761bb0abe624b72f3f462306f3b8ff9d824a7 Mon Sep 17 00:00:00 2001 From: Jacalz Date: Wed, 23 Dec 2020 15:36:23 +0100 Subject: [PATCH 2/2] Add in a couple missed changes --- cmd/arc/main.go | 2 +- testdata/create-evil-zip.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/arc/main.go b/cmd/arc/main.go index 1050cd05..fd28ac5f 100644 --- a/cmd/arc/main.go +++ b/cmd/arc/main.go @@ -2,7 +2,6 @@ package main import ( "archive/tar" - "archive/zip" "bytes" "compress/flate" "flag" @@ -11,6 +10,7 @@ import ( "path/filepath" "strings" + "github.com/klauspost/compress/zip" "github.com/mholt/archiver/v3" "github.com/nwaples/rardecode" ) diff --git a/testdata/create-evil-zip.go b/testdata/create-evil-zip.go index 972fdb11..197b6475 100644 --- a/testdata/create-evil-zip.go +++ b/testdata/create-evil-zip.go @@ -1,10 +1,11 @@ package main import ( - "archive/zip" "log" "os" "time" + + "github.com/klauspost/compress/zip" ) func main() {