unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* arc-mode.el bug or malformed ZIP file?
@ 2020-09-23 23:13 Stephen Berman
  2020-09-24  2:05 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Berman @ 2020-09-23 23:13 UTC (permalink / raw)
  To: emacs-devel

I have a ZIP file that, when I try to visit it in archive-mode, Emacs
throws a file mode specification error on, specifically
args-out-of-range.  The reason is that the function archive-l-e in
arc-mode.el, which is supposed to return a buffer position in this case,
returns a number which exceeds the buffer size.  And the reason for this
is that archive-l-e builds its return value by iteratively calling (+
(ash result 8) (aref str (- len i))), where `str' is a string extracted
from the end of the ZIP file, which in this case is "\377\377\377\377",
so that the return value increases from 255 (the decimal value of octal
377) to 4294967040 after four iterations, which far exceeds the file
(and hence buffer) size.

Perhaps "\377\377\377\377" is an invalid string at the end of a ZIP file
(I checked two other ZIP files I have, which I can visit in archive-mode
with no problem, and they have different strings at the end, consisting
of bytes with smaller decimal values, so that the return value of
archive-l-e does not exceed the file size).  Yet when I call `unzip -l'
on the file in the shell, the contents are displayed, and I also had no
problem unpacking the file with unzip (and AFAICT the content is
undamaged).  So at least unzip can deal with this file.  So is this a
bug in arc-mode.el?

Steve Berman



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

end of thread, other threads:[~2020-09-28 18:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23 23:13 arc-mode.el bug or malformed ZIP file? Stephen Berman
2020-09-24  2:05 ` Stefan Monnier
2020-09-24 20:02   ` Stephen Berman
2020-09-28 17:08     ` Stefan Monnier
2020-09-28 18:11       ` 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).