From 58965d91e7fb5a26a5422357f44d6e841f67db74 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 1 Jun 2022 21:57:07 +0300 Subject: [PATCH] Avoid segfaults on MS-Windows when invoked with --version * src/emacs.c (main): If invoked with --version, call 'init_bignum' before calling 'format-time-string', as that is needed for safe manipulation of bignums in timefns.c. --- src/emacs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/emacs.c b/src/emacs.c index 9197a19f368..e4257a66b4c 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1428,6 +1428,11 @@ main (int argc, char **argv) if (initialized) { Lisp_Object tem, tem2; + + /* Fformat_time_string below manipulates bignums, so we need + this initialization. */ + init_bignum (); + tem = Fsymbol_value (intern_c_string ("emacs-version")); tem2 = Fsymbol_value (intern_c_string ("emacs-copyright")); if (!STRINGP (tem)) -- 2.39.2