From 036f0fe8429558aa2971091c5e4382c1eed1d66e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 9 Mar 2018 12:06:05 -0800 Subject: [PATCH] Fix string-to-number C-level mishandling * src/sysdep.c (list_system_processes): * src/xfaces.c (Finternal_set_lisp_face_attribute_from_resource): Defend against Fstring_to_number returning a float or a nonsense integer. --- src/sysdep.c | 6 +++++- src/xfaces.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sysdep.c b/src/sysdep.c index c59034ce5c3..1eaf648ea78 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -3006,7 +3006,11 @@ list_system_processes (void) for (tail = proclist; CONSP (tail); tail = next) { next = XCDR (tail); - XSETCAR (tail, Fstring_to_number (XCAR (tail), Qnil)); + Lisp_Object pidstring = XCAR (tail); + Lisp_Object pid = Fstring_to_number (pidstring, Qnil); + if (!INTEGERP (pid) || XINT (pid) <= 0) + xsignal1 (Qoverflow_error, pidstring); + XSETCAR (tail, pid); } /* directory_files_internal returns the files in reverse order; undo diff --git a/src/xfaces.c b/src/xfaces.c index 77afee4587d..56df06574a7 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -3393,7 +3393,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource", else if (EQ (attr, QCheight)) { value = Fstring_to_number (value, make_number (10)); - if (XINT (value) <= 0) + if (!INTEGERP (value) || XINT (value) <= 0) signal_error ("Invalid face height from X resource", value); } else if (EQ (attr, QCbold) || EQ (attr, QCitalic)) -- 2.39.2