On Wed, 2018-07-04 at 18:07 +0300, Eli Zaretskii wrote: > > From: Jonathan Kyle Mitchell > > Date: Tue, 03 Jul 2018 22:12:57 -0500 > > Cc: 32038@debbugs.gnu.org > > > > 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. > > Thanks, but I think we should log the error in *Messages*, because > otherwise the error will go unnoticed. > > > + if (EQ (Fmod (Flength (props), make_number > > (2)), > > + make_number (0))) > > We are on the C level, so it is easier/simpler to do this instead: > > ptrdiff_t seqlen = XFASTINT (Flength (props)); > if (seqlen % 2 == 0) > Fset_text_properties (...); > > More importantly, Flength can signal an error if PROPS is too long, > so > I'm not sure the idea of your patch is 100% correct, because the code > you propose can still signal an error. An alternative would be to > call Fset_text_properties via internal_condition_case_n, like we do > in > safe__call. That makes sense. I added one function to call Fset_text_properties through internal_condition_case_n in the attached revised patch. The error gets caught and safe_eval_handler appends an error message to the *Messages* buffer. The error message is put in *Messages* on the first time only though, subsequent (force-mode-line-update) calls just append nil. I don't know if that's expected for redisplay's internal messaging routines. Thanks for reviewing the patch. -- Jonathan Kyle Mitchell