GNU bug report logs -
#62790
29.0.60; WEBP header regexp in image-type-header-regexps fails files containing newlines
Previous Next
Reported by: Visuwesh <visuweshm <at> gmail.com>
Date: Wed, 12 Apr 2023 13:48:02 UTC
Severity: normal
Merged with 62789
Found in version 29.0.60
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#62790: 29.0.60; WEBP header regexp in image-type-header-regexps fails files containing newlines
which was filed against the emacs package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 62789 <at> debbugs.gnu.org.
--
62790: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62790
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
> From: Visuwesh <visuweshm <at> gmail.com>
> Cc: 62790 <at> debbugs.gnu.org
> Date: Wed, 12 Apr 2023 22:22:29 +0530
>
> [புதன் ஏப்ரல் 12, 2023] Eli Zaretskii wrote:
>
> > Thanks, but please show a recipe, starting from "emacs -Q", to
> > reproduce the problem with this image. I just visited it with
> > "C-x C-f" and didn't see any problems.
>
> Please evaluate
>
> (create-image
> (with-temp-buffer
> (insert-file-contents-literally "/path/to/attached/image")
> (buffer-string))
> nil t)
>
> in emacs -Q and observe the return value. It will return nil even
> though it is a valid webp file. The reason C-x C-f succeeds is because
> the file has the "webp" extension and thusly `image-supported-p' call in
> `image-type' returns non-nil.
Thanks, installed on the emacs-29 branch, and closing the bug.
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/plain, inline)]
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.
[004.webp (image/webp, attachment)]
[Message part 6 (text/plain, inline)]
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))
This bug report was last modified 2 years and 41 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.