summaryrefslogtreecommitdiff
path: root/lisp/arc-mode.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2020-09-25 17:11:11 +0300
committerEli Zaretskii <eliz@gnu.org>2020-09-25 17:11:11 +0300
commitf31c6792ab98c8be343838f59d96e35c05353521 (patch)
tree782ed2a161e7edbd3b5eb2f9926e9a1a18a79bb3 /lisp/arc-mode.el
parentba635a19fb0143a2f9d486125f0b6f54034fdadb (diff)
downloademacs-f31c6792ab98c8be343838f59d96e35c05353521.tar.gz
emacs-f31c6792ab98c8be343838f59d96e35c05353521.tar.bz2
emacs-f31c6792ab98c8be343838f59d96e35c05353521.zip
Fix support for Zip64 zip files
* lisp/arc-mode.el (archive-zip-summarize): Fix detection of Zip64 central directory. Support 64-bit file size field used by Zip64. (Bug#43597)
Diffstat (limited to 'lisp/arc-mode.el')
-rw-r--r--lisp/arc-mode.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index d6e85bf3835..c09f78e0d24 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -1799,10 +1799,10 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
files
visual
emacs-int-has-32bits)
- (when (= p -1)
- ;; If the offset of end-of-central-directory is -1, this is a
- ;; Zip64 extended ZIP file format, and we need to glean the info
- ;; from Zip64 records instead.
+ (when (or (= p #xffffffff) (= p -1))
+ ;; If the offset of end-of-central-directory is 0xFFFFFFFF, this
+ ;; is a Zip64 extended ZIP file format, and we need to glean the
+ ;; info from Zip64 records instead.
;;
;; First, find the Zip64 end-of-central-directory locator.
(search-backward "PK\006\007")
@@ -1828,6 +1828,15 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
(efnname (let ((str (buffer-substring (+ p 46) (+ p 46 fnlen))))
(decode-coding-string
str archive-file-name-coding-system)))
+ (ucsize (if (and (or (= ucsize #xffffffff) (= ucsize -1))
+ (> exlen 0))
+ ;; APPNOTE.TXT, para 4.5.3: the Extra Field
+ ;; begins with 2 bytes of signature
+ ;; (\000\001), followed by 2 bytes that give
+ ;; the size of the extra block, followed by
+ ;; an 8-byte uncompressed size.
+ (archive-l-e (+ p 46 fnlen 4) 8)
+ ucsize))
(isdir (and (= ucsize 0)
(string= (file-name-nondirectory efnname) "")))
(mode (cond ((memq creator '(2 3)) ; Unix