Patch 8.2.0449
Problem:    Vim9: crash if return type is invalid. (Yegappan Lakshmanan)
Solution:   Always return some type, not NULL.
Files:      src/vim9compile.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.0448/src/vim9compile.c   2020-03-23 22:12:15.496961030 +0100
--- src/vim9compile.c   2020-03-26 13:14:08.819262862 +0100
***************
*** 1375,1393 ****
            emsg(_("E1007: No white space allowed before <"));
        else
            emsg(_("E1008: Missing <type>"));
!       return NULL;
      }
      *arg = skipwhite(*arg + 1);
  
      member_type = parse_type(arg, type_list);
      if (member_type == NULL)
!       return NULL;
  
      *arg = skipwhite(*arg);
      if (**arg != '>')
      {
        emsg(_("E1009: Missing > after type"));
!       return NULL;
      }
      ++*arg;
  
--- 1375,1393 ----
            emsg(_("E1007: No white space allowed before <"));
        else
            emsg(_("E1008: Missing <type>"));
!       return type;
      }
      *arg = skipwhite(*arg + 1);
  
      member_type = parse_type(arg, type_list);
      if (member_type == NULL)
!       return type;
  
      *arg = skipwhite(*arg);
      if (**arg != '>')
      {
        emsg(_("E1009: Missing > after type"));
!       return type;
      }
      ++*arg;
  
*** ../vim-8.2.0448/src/testdir/test_vim9_script.vim    2020-03-22 
13:44:25.102475151 +0100
--- src/testdir/test_vim9_script.vim    2020-03-26 13:14:37.703004961 +0100
***************
*** 269,274 ****
--- 269,277 ----
    CheckScriptFailure(['def Func(): string', 'return 1', 'enddef'], 'expected 
string but got number')
    CheckScriptFailure(['def Func(): void', 'return "a"', 'enddef'], 'expected 
void but got string')
    CheckScriptFailure(['def Func()', 'return "a"', 'enddef'], 'expected void 
but got string')
+ 
+   CheckScriptFailure(['def Func(): list', 'return []', 'enddef'], 'E1008:')
+   CheckScriptFailure(['def Func(): dict', 'return {}', 'enddef'], 'E1008:')
  enddef
  
  def Test_arg_type_wrong()
*** ../vim-8.2.0448/src/version.c       2020-03-25 22:23:41.902363556 +0100
--- src/version.c       2020-03-26 13:05:07.035743052 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     449,
  /**/

-- 
DENNIS:  Listen -- strange women lying in ponds distributing swords is no
         basis for a system of government.  Supreme executive power derives
         from a mandate from the masses, not from some farcical aquatic
         ceremony.
                                  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/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202003261216.02QCGNmE031473%40masaka.moolenaar.net.

Raspunde prin e-mail lui