]> granicus.if.org Git - vim/commitdiff
patch 8.2.3673: crash when allocating signal stack fails v8.2.3673
authorBram Moolenaar <Bram@vim.org>
Thu, 25 Nov 2021 13:39:28 +0000 (13:39 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 25 Nov 2021 13:39:28 +0000 (13:39 +0000)
Problem:    Crash when allocating signal stack fails.
Solution:   Only using sourcing info when available. (closes #9215)

src/globals.h
src/message.c
src/version.c

index 90998d8752ba8d4f26e536fbe90ce299aa574e16..8f4f5a575ca49a100143e1dbe88a84b0d9501d93 100644 (file)
@@ -288,6 +288,7 @@ EXTERN int  msg_no_more INIT(= FALSE);  // don't use more prompt, truncate
  * Current context is at ga_len - 1.
  */
 EXTERN garray_T        exestack INIT5(0, 0, sizeof(estack_T), 50, NULL);
+#define HAVE_SOURCING_INFO  (exestack.ga_data != NULL && exestack.ga_len > 0)
 // name of error message source
 #define SOURCING_NAME (((estack_T *)exestack.ga_data)[exestack.ga_len - 1].es_name)
 // line number in the message source or zero
index 0cd09da9f4a63d8c6a5c1b9c5984babfcb275c98..e438211fa15abc59120292eabe081d47da51b0cc 100644 (file)
@@ -446,7 +446,7 @@ reset_last_sourcing(void)
     static int
 other_sourcing_name(void)
 {
-    if (SOURCING_NAME != NULL)
+    if (HAVE_SOURCING_INFO && SOURCING_NAME != NULL)
     {
        if (last_sourcing_name != NULL)
            return STRCMP(SOURCING_NAME, last_sourcing_name) != 0;
@@ -465,7 +465,7 @@ get_emsg_source(void)
 {
     char_u     *Buf, *p;
 
-    if (SOURCING_NAME != NULL && other_sourcing_name())
+    if (HAVE_SOURCING_INFO && SOURCING_NAME != NULL && other_sourcing_name())
     {
        char_u      *sname = estack_sfile(ESTACK_NONE);
        char_u      *tofree = sname;
index d1004bb1eeb2d89f83e481459fd957c3ff801ddd..3f831037365b0cf5bc177e89f607a4dfae573be6 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3673,
 /**/
     3672,
 /**/