unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#62790: 29.0.60; WEBP header regexp in image-type-header-regexps fails files containing newlines
@ 2023-04-12 13:47 Visuwesh
  2023-04-12 15:53 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Visuwesh @ 2023-04-12 13:47 UTC (permalink / raw)
  To: 62790

[-- Attachment #1: Type: text/plain, Size: 228 bytes --]


Attached image contains a newline in the header after "RIFF" which the
regexp in image-type-header-regexps fails to match.  This makes
create-image return nil for such an image when FILE-OR-DATA is DATA and
DATA-P is non-nil.


[-- Attachment #2: 004.webp --]
[-- Type: image/webp, Size: 663236 bytes --]

[-- Attachment #3: Type: text/plain, Size: 2951 bytes --]


The following patch fixes the issue for me,

diff --git a/lisp/image.el b/lisp/image.el
index 29c39c5dd5..9221057bce 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -51,7 +51,7 @@ image-type-header-regexps
     ("\\`\\(?:MM\0\\*\\|II\\*\0\\)" . tiff)
     ("\\`[\t\n\r ]*%!PS" . postscript)
     ("\\`\xff\xd8" . jpeg)    ; used to be (image-jpeg-p . jpeg)
-    ("\\`RIFF....WEBPVP8" . webp)
+    ("\\`RIFF[^z-a][^z-a][^z-a][^z-a]WEBPVP8" . webp)
     (,(let* ((incomment-re "\\(?:[^-]\\|-[^-]\\)")
 	     (comment-re (concat "\\(?:!--" incomment-re "*-->[ \t\r\n]*<\\)")))
 	(concat "\\(?:<\\?xml[ \t\r\n]+[^>]*>\\)?[ \t\r\n]*<"

[ [^z-a] is documented in (info "(elisp) Regexp Special").  ]


In GNU Emacs 29.0.60 (build 2, x86_64-pc-linux-gnu, X toolkit, Xaw
 scroll bars) of 2023-03-23 built on astatine
Repository revision: be8147c53f9dd2d896c27d5b32bf4f38b0af9b3f
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --with-sound=alsa --with-x-toolkit=lucid --with-json
 --without-xaw3d --without-gconf --without-libsystemd --without-cairo'
Configured features:
ACL DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XFT
XIM XINPUT2 XPM LUCID ZLIB
Important settings:
  value of $LC_MONETARY: ta_IN.UTF-8
  value of $LC_NUMERIC: ta_IN.UTF-8
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  hexl-follow-ascii: t
  csv-field-index-mode: t
  recentf-mode: t
  shell-dirtrack-mode: t
  server-mode: t
  paredit-mode: t
  eros-mode: t
  flymake-mode: t
  pdf-occur-global-minor-mode: t
  minibuffer-depth-indicate-mode: t
  repeat-mode: t
  display-time-mode: t
  display-battery-mode: t
  delete-selection-mode: t
  xterm-mouse-mode: t
  straight-use-package-mode: t
  straight-package-neutering-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  use-hard-newlines: t
  tab-bar-history-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  undelete-frame-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(ruler-mode hl-line hexl expand-region text-mode-expansions
cc-mode-expansions the-org-mode-expansions python-el-fgallina-expansions
er-basic-expansions expand-region-core ...)

Memory information:
((conses 16 5541494 789498)
 (symbols 48 70186 141)
 (strings 32 495814 72788)
 (string-bytes 1 144111870)
 (vectors 16 216791)
 (vector-slots 8 4288415 706143)
 (floats 8 37436 2621)
 (intervals 56 497259 17293)
 (buffers 976 448))

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

end of thread, other threads:[~2023-04-12 17:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-12 13:47 bug#62790: 29.0.60; WEBP header regexp in image-type-header-regexps fails files containing newlines Visuwesh
2023-04-12 15:53 ` Eli Zaretskii
2023-04-12 16:52   ` Visuwesh
2023-04-12 17:05     ` 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).