unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: stephen.berman@gmx.net
Cc: 43597@debbugs.gnu.org
Subject: bug#43597: 28.0.50; arc-mode.el fails to display a ZIP file
Date: Fri, 25 Sep 2020 16:33:21 +0300	[thread overview]
Message-ID: <83mu1ernfi.fsf@gnu.org> (raw)
In-Reply-To: <83o8lurpq3.fsf@gnu.org> (message from Eli Zaretskii on Fri, 25 Sep 2020 15:43:48 +0300)

> Date: Fri, 25 Sep 2020 15:43:48 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 43597@debbugs.gnu.org
> 
> > Date: Fri, 25 Sep 2020 15:38:56 +0300
> > From: Eli Zaretskii <eliz@gnu.org>
> > Cc: 43597@debbugs.gnu.org
> > 
> > Thanks, with this file I do see the problem.
> 
> Oops, I spoke too soon, using the wrong version of Emacs to test this.
> 
> The change -1 => #xffffffff fixes the problem with this file as well.
> So I guess the remaining issues rear their ugly heads in a 64-bit
> Emacs, and I need to debug there...

Wrong again, sigh...  This has nothing to do with 64-bit builds.

Anyway, here's the proposed patch, please test:

diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index d6e85bf..c09f78e 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -1799,10 +1799,10 @@ archive-zip-summarize
         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 @@ archive-zip-summarize
              (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





  parent reply	other threads:[~2020-09-25 13:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24 20:02 bug#43597: 28.0.50; arc-mode.el fails to display a ZIP file Stephen Berman
2020-09-24 20:25 ` Andreas Schwab
2020-09-24 20:40   ` Stephen Berman
2020-09-24 21:58     ` Stephen Berman
2020-09-24 22:20       ` Stephen Berman
2020-09-25  6:01     ` Eli Zaretskii
2020-09-25  7:13       ` Stephen Berman
2020-09-25  9:37         ` Eli Zaretskii
2020-09-25  9:53           ` Eli Zaretskii
2020-09-25 10:32             ` Stephen Berman
2020-09-25 11:00             ` Eli Zaretskii
2020-09-25 12:05               ` Stephen Berman
2020-09-25 12:38                 ` Eli Zaretskii
2020-09-25 12:43                   ` Eli Zaretskii
2020-09-25 12:49                     ` Stephen Berman
2020-09-25 13:33                     ` Eli Zaretskii [this message]
2020-09-25 13:58                       ` Stephen Berman
2020-09-25 14:12                         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83mu1ernfi.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=43597@debbugs.gnu.org \
    --cc=stephen.berman@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).