To: [email protected]
Subject: Patch 7.2b.023
Fcc: outbox
From: Bram Moolenaar <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.2b.023
Problem:    Crash when using the result of synstack(0,0). (Matt Wozniski)
Solution:   Check for v_list to be NULL in a few more places.
Files:      src/eval.c


*** ../vim-7.2b.022/src/eval.c  Thu Jul 24 18:44:23 2008
--- src/eval.c  Sun Jul 27 14:31:11 2008
***************
*** 1275,1281 ****
       if (dolist && tv.v_type == VAR_LIST)
       {
           ga_init2(&ga, (int)sizeof(char), 80);
!           list_join(&ga, tv.vval.v_list, (char_u *)"\n", TRUE, 0);
           ga_append(&ga, NUL);
           retval = (char_u *)ga.ga_data;
       }
--- 1275,1282 ----
       if (dolist && tv.v_type == VAR_LIST)
       {
           ga_init2(&ga, (int)sizeof(char), 80);
!           if (tv.vval.v_list != NULL)
!               list_join(&ga, tv.vval.v_list, (char_u *)"\n", TRUE, 0);
           ga_append(&ga, NUL);
           retval = (char_u *)ga.ga_data;
       }
***************
*** 1380,1385 ****
--- 1381,1387 ----
 /*
  * Evaluate an expression to a list with suggestions.
  * For the "expr:" part of 'spellsuggest'.
+  * Returns NULL when there is an error.
  */
     list_T *
 eval_spell_expr(badword, expr)
***************
*** 1587,1594 ****
 # endif

 /*
!  * Call vimL function "func" and return the result as a list
  * Uses argv[argc] for the function arguments.
  */
     void *
 call_func_retlist(func, argc, argv, safe)
--- 1589,1597 ----
 # endif

 /*
!  * Call vimL function "func" and return the result as a List.
  * Uses argv[argc] for the function arguments.
+  * Returns NULL when there is something wrong.
  */
     void *
 call_func_retlist(func, argc, argv, safe)
***************
*** 5817,5822 ****
--- 5820,5827 ----
 {
     listitem_T        *item1, *item2;

+     if (l1 == NULL || l2 == NULL)
+       return FALSE;
     if (l1 == l2)
       return TRUE;
     if (list_len(l1) != list_len(l2))
***************
*** 5855,5860 ****
--- 5860,5867 ----
     dictitem_T        *item2;
     int               todo;

+     if (d1 == NULL || d2 == NULL)
+       return FALSE;
     if (d1 == d2)
       return TRUE;
     if (dict_len(d1) != dict_len(d2))
***************
*** 6243,6248 ****
--- 6250,6258 ----
 {
     list_T    *l;

+     if (l1 == NULL || l2 == NULL)
+       return FAIL;
+
     /* make a copy of the first list. */
     l = list_copy(l1, FALSE, 0);
     if (l == NULL)
*** ../vim-7.2b.022/src/version.c       Sat Jul 26 16:03:55 2008
--- src/version.c       Sun Jul 27 15:54:45 2008
***************
*** 678,679 ****
--- 678,681 ----
 {   /* Add new patch number below this line */
+ /**/
+     23,
 /**/

--
ARTHUR:  Well, I AM king...
DENNIS:  Oh king, eh, very nice.  An' how'd you get that, eh?  By exploitin'
        the workers -- by 'angin' on to outdated imperialist dogma which
        perpetuates the economic an' social differences in our society!  If
        there's ever going to be any progress--
                                 The Quest for the Holy Grail (Monty Python)

/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
\\\            help me help AIDS victims -- http://ICCF-Holland.org    ///