emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#20665: closed (24.5.50; Error when opening zip 3.0


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#20665: closed (24.5.50; Error when opening zip 3.0 file in arc-mode)
Date: Wed, 27 May 2015 14:40:04 +0000

Your message dated Wed, 27 May 2015 17:39:04 +0300
with message-id <address@hidden>
and subject line Re: bug#20665: 24.5.50; Error when opening zip 3.0 file in 
arc-mode
has caused the debbugs.gnu.org bug report #20665,
regarding 24.5.50; Error when opening zip 3.0 file in arc-mode
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
20665: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20665
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.5.50; Error when opening zip 3.0 file in arc-mode Date: Tue, 26 May 2015 15:34:44 -0400


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 #<buffer resource_ead1.zip> 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.
If I do M-! file resource_ead1.zip I get
resource_ead1.zip: Zip archive data, at least v3.0 to extract
I can open other zips with arc-mode that are not zip v3.0 with no problem.

Attached is the file that caused the problem with an additional file extension to get around gmail's blocking.


In GNU Emacs 24.5.50.1 (x86_64-unknown-linux-gnu)
 of 2015-05-26 on bdc34-laptop
Repository revision: 82e2ce9d792e6bd76cd517589d5b89144497ecf8
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description: Linux Mint 17.1 Rebecca

Configured using:
 `configure --with-x-toolkit=no --with-xpm=no --with-jpeg=no
 --with-png=no --with-gif=no --with-tiff=no'

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Zip-Archive

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
Parsing archive file...
File mode specification error: (args-out-of-range #<buffer resource_ead2.zip> 4294967296 4294967300)
Making completion list...
delete-backward-char: Text is read-only
Making completion list... [2 times]
user-error: End of history; no default available [2 times]

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
help-fns mail-prsvr mail-utils help-mode easymenu vc-git arc-mode
archive-mode dired time-date tooltip electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process inotify
dynamic-setting x multi-tty emacs)

Memory information:
((conses 16 81906 8122)
 (symbols 48 18201 0)
 (miscs 40 69 188)
 (strings 32 11919 4418)
 (string-bytes 1 324124)
 (vectors 16 9763)
 (vector-slots 8 382731 8409)
 (floats 8 65 163)
 (intervals 56 633 24)
 (buffers 960 20)
 (heap 1024 37579 586))

Attachment: resource_ead1.zip.removethisextention
Description: Binary data


--- End Message ---
--- Begin Message --- Subject: Re: bug#20665: 24.5.50; Error when opening zip 3.0 file in arc-mode Date: Wed, 27 May 2015 17:39:04 +0300
> Date: Tue, 26 May 2015 15:34:44 -0400
> From: Brian Caruso <address@hidden>
> 
> 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 #<buffer resource_ead1.zip>
> 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 <address@hidden>
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))


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]