unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20665: 24.5.50; Error when opening zip 3.0 file in arc-mode
@ 2015-05-26 19:34 Brian Caruso
  2015-05-27 14:39 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Caruso @ 2015-05-26 19:34 UTC (permalink / raw)
  To: 20665


[-- Attachment #1.1: Type: text/plain, Size: 3244 bytes --]

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 #1.2: Type: text/html, Size: 4358 bytes --]

[-- Attachment #2: resource_ead1.zip.removethisextention --]
[-- Type: application/octet-stream, Size: 633 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#20665: 24.5.50; Error when opening zip 3.0 file in arc-mode
  2015-05-26 19:34 bug#20665: 24.5.50; Error when opening zip 3.0 file in arc-mode Brian Caruso
@ 2015-05-27 14:39 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2015-05-27 14:39 UTC (permalink / raw)
  To: Brian Caruso; +Cc: 20665-done

> Date: Tue, 26 May 2015 15:34:44 -0400
> From: Brian Caruso <briancaruso@gmail.com>
> 
> 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 <eliz@gnu.org>
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))





^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-27 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-26 19:34 bug#20665: 24.5.50; Error when opening zip 3.0 file in arc-mode Brian Caruso
2015-05-27 14:39 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).