From df374dc2053b193b5c98c36e3ddd4c38e45f23b8 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Thu, 23 Feb 2023 18:16:28 -0800 Subject: [PATCH] Fix segmentation fault when merging faces in a noninteractive Emacs * src/xfaces.c (internal-merge-in-global-face): Signal an error when 'noninteractive' is true. --- src/xfaces.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/xfaces.c b/src/xfaces.c index 62d7823f308..e1900f4cedb 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4162,6 +4162,11 @@ DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face, Lisp_Object global_lface, local_lface, *gvec, *lvec; struct frame *f = XFRAME (frame); + /* If this process is noninteractive, we likely don't have a face + cache, so attempts to use it below would segfault. */ + if (noninteractive) + error ("Attempt to merge faces in noninteractive Emacs"); + CHECK_LIVE_FRAME (frame); global_lface = lface_from_face_name (NULL, face, true); local_lface = lface_from_face_name (f, face, false); -- 2.25.1