From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#20665: 24.5.50; Error when opening zip 3.0 file in arc-mode Date: Wed, 27 May 2015 17:39:04 +0300 Message-ID: <83zj4qxeyf.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1432737669 6339 80.91.229.3 (27 May 2015 14:41:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 May 2015 14:41:09 +0000 (UTC) Cc: 20665-done@debbugs.gnu.org To: Brian Caruso Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 27 16:40:57 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YxcVt-0005fs-5y for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 May 2015 16:40:57 +0200 Original-Received: from localhost ([::1]:54262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxcVs-0006xv-Ig for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 May 2015 10:40:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxcV7-00069l-67 for bug-gnu-emacs@gnu.org; Wed, 27 May 2015 10:40:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxcV3-0001SB-4i for bug-gnu-emacs@gnu.org; Wed, 27 May 2015 10:40:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48517) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxcV3-0001Rl-2g for bug-gnu-emacs@gnu.org; Wed, 27 May 2015 10:40:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YxcV2-0001b7-NI for bug-gnu-emacs@gnu.org; Wed, 27 May 2015 10:40:04 -0400 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 May 2015 14:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 20665 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 20665@debbugs.gnu.org, eliz@gnu.org, briancaruso@gmail.com Original-Received: via spool by 20665-done@debbugs.gnu.org id=D20665.14327375846105 (code D ref 20665); Wed, 27 May 2015 14:40:03 +0000 Original-Received: (at 20665-done) by debbugs.gnu.org; 27 May 2015 14:39:44 +0000 Original-Received: from localhost ([127.0.0.1]:58491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YxcUd-0001aK-Kl for submit@debbugs.gnu.org; Wed, 27 May 2015 10:39:43 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:60478) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YxcUY-0001a3-02 for 20665-done@debbugs.gnu.org; Wed, 27 May 2015 10:39:38 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NP000B00J8AMG00@a-mtaout20.012.net.il> for 20665-done@debbugs.gnu.org; Wed, 27 May 2015 17:39:12 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NP000BKZJDCIM50@a-mtaout20.012.net.il>; Wed, 27 May 2015 17:39:12 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:103217 Archived-At: > Date: Tue, 26 May 2015 15:34:44 -0400 > From: Brian Caruso > > I started with emacs -Q > The did C-x C-f and selected the file with RET > I got this error in *Messages*: > "Parsing archive file... > File mode specification error: (args-out-of-range # > 4294967296 4294967300)" > I expected the arc-mode dired-like view of the file list of the zip, > but I got a buffer with the byte contents of the zip file. Thanks, I fixed this in commit 1719816 for the next Emacs release. The changes appear below, so you should be able to patch your arc-mode.el and resolve this problem. commit 171981622f072546aed135668e53fdeb7b012631 Author: Eli Zaretskii Date: Wed May 27 17:35:11 2015 +0300 Support ZIP files that use Zip64 extensions * lisp/arc-mode.el (archive-zip-summarize): Handle the new ZIP format of central directory offsets used by Zip64 extensions. (Bug#20665) diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 063e4ba..5f2fc8f 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -1811,11 +1811,38 @@ (defalias 'archive-lzh-exe-extract 'archive-lzh-extract (defun archive-zip-summarize () (goto-char (- (point-max) (- 22 18))) (search-backward-regexp "[P]K\005\006") - (let ((p (+ (point-min) (archive-l-e (+ (point) 16) 4))) + (let ((p (archive-l-e (+ (point) 16) 4)) (maxlen 8) (totalsize 0) files - visual) + 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. + ;; + ;; First, find the Zip64 end-of-central-directory locator. + (search-backward "PK\006\007") + ;; Pay attention: the offset of Zip64 end-of-central-directory + ;; is a 64-bit field, so it could overflow the Emacs integer + ;; even on a 64-bit host, let alone 32-bit one. But since we've + ;; already read the zip file into a buffer, and this is a byte + ;; offset into the file we've read, it must be short enough, so + ;; such an overflow can never happen, and we can safely read + ;; these 8 bytes into an Emacs integer. Moreover, on host with + ;; 32-bit Emacs integer we can only read 4 bytes, since they are + ;; stored in little-endian byte order. + (setq emacs-int-has-32bits (<= most-positive-fixnum #x1fffffff)) + (setq p (+ (point-min) + (archive-l-e (+ (point) 8) (if emacs-int-has-32bits 4 8)))) + (goto-char p) + ;; We should be at Zip64 end-of-central-directory record now. + (or (string= "PK\006\006" (buffer-substring p (+ p 4))) + (error "Unrecognized ZIP file format")) + ;; Offset to central directory: + (setq p (+ (point-min) + (archive-l-e (+ p 48) (if emacs-int-has-32bits 4 8))))) (while (string= "PK\001\002" (buffer-substring p (+ p 4))) (let* ((creator (byte-after (+ p 5))) ;; (method (archive-l-e (+ p 10) 2))