all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jonathan Kyle Mitchell <kyle@jonathanmitchell.org>
To: "Michał Kondraciuk" <k.michal@zoho.com>
Cc: 32038@debbugs.gnu.org
Subject: bug#32038: 27.0.50; Emacs hangs when using :propertize mode line construct and not providing a property value
Date: Tue, 03 Jul 2018 22:12:57 -0500	[thread overview]
Message-ID: <871scj7kxy.fsf@jonathanmitchell.org> (raw)
In-Reply-To: <8736x16i4t.fsf@jonathanmitchell.org>

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

found 32038 26.1
tags 32038 + patch
quit

I think I found a way to make redisplay ignore any malformed property list by
putting a single check around Fset_text_properties in xdisp.c. The text of the
modeline is still set according to the provided string, but the property list
is ignored if it doesn't have an even number of elements. It doesn't
infinitely loop anymore given a malformed property list.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: verify plist before use patch --]
[-- Type: text/x-patch, Size: 1263 bytes --]

From 17eab01494e92e4f9582c56e73ae49278158b016 Mon Sep 17 00:00:00 2001
From: Jonathan Kyle Mitchell <kyle@jonathanmitchell.org>
Date: Tue, 3 Jul 2018 21:44:21 -0500
Subject: [PATCH] Verify plist is a plist before use

Do not blindly use a plist that came from Lisp to set text properties.  This
causes Fset_text_properties to go into an infinite loop during redisplay when
it catches the error in the global error handler (bug#32038).
* src/xdisp.c (display_mode_element):
---
 src/xdisp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 9b4febdd61..5f52a5ba6c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -23610,8 +23610,12 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
 			= Fdelq (aelt, mode_line_proptrans_alist);
 
 		    elt = Fcopy_sequence (elt);
-		    Fset_text_properties (make_number (0), Flength (elt),
-					  props, elt);
+		    if (EQ (Fmod (Flength (props), make_number (2)),
+			    make_number (0)))
+		      {
+			Fset_text_properties (make_number (0), Flength (elt),
+					      props, elt);
+		      }
 		    /* Add this item to mode_line_proptrans_alist.  */
 		    mode_line_proptrans_alist
 		      = Fcons (Fcons (elt, props),
-- 
2.17.1


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


--
Jonathan Kyle Mitchell

  reply	other threads:[~2018-07-04  3:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-02 16:15 bug#32038: 27.0.50; Emacs hangs when using :propertize mode line construct and not providing a property value Michał Kondraciuk
2018-07-03  1:24 ` Jonathan Kyle Mitchell
2018-07-03  4:46   ` Jonathan Kyle Mitchell
2018-07-04  3:12     ` Jonathan Kyle Mitchell [this message]
2018-07-04 15:07       ` Eli Zaretskii
2018-07-05  4:14         ` Jonathan Kyle Mitchell
2018-07-14 11:30           ` Eli Zaretskii
2018-07-15 17:21             ` Jonathan Kyle Mitchell
2018-07-21 16:39 ` bug#32237: 27.0.50; Function in before-change-functions is called with first argument greater than the second Michał Kondraciuk
2018-07-21 18:06   ` 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

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

  git send-email \
    --in-reply-to=871scj7kxy.fsf@jonathanmitchell.org \
    --to=kyle@jonathanmitchell.org \
    --cc=32038@debbugs.gnu.org \
    --cc=k.michal@zoho.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.