Karsten Hopp dc681d
To: vim_dev@googlegroups.com
Karsten Hopp dc681d
Subject: Patch 7.3.683
Karsten Hopp dc681d
Fcc: outbox
Karsten Hopp dc681d
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp dc681d
Mime-Version: 1.0
Karsten Hopp dc681d
Content-Type: text/plain; charset=UTF-8
Karsten Hopp dc681d
Content-Transfer-Encoding: 8bit
Karsten Hopp dc681d
------------
Karsten Hopp dc681d
Karsten Hopp dc681d
Patch 7.3.683
Karsten Hopp dc681d
Problem:    ":python" may crash when vimbindeval() returns None.
Karsten Hopp dc681d
Solution:   Check for v_string to be NULL. (Yukihiro Nakadaira)
Karsten Hopp dc681d
Files:	    src/if_py_both.h
Karsten Hopp dc681d
Karsten Hopp dc681d
Karsten Hopp dc681d
*** ../vim-7.3.682/src/if_py_both.h	2012-09-21 14:00:05.000000000 +0200
Karsten Hopp dc681d
--- src/if_py_both.h	2012-10-05 21:05:06.000000000 +0200
Karsten Hopp dc681d
***************
Karsten Hopp dc681d
*** 351,357 ****
Karsten Hopp dc681d
  
Karsten Hopp dc681d
      if (our_tv->v_type == VAR_STRING)
Karsten Hopp dc681d
      {
Karsten Hopp dc681d
! 	result = Py_BuildValue("s", our_tv->vval.v_string);
Karsten Hopp dc681d
      }
Karsten Hopp dc681d
      else if (our_tv->v_type == VAR_NUMBER)
Karsten Hopp dc681d
      {
Karsten Hopp dc681d
--- 351,358 ----
Karsten Hopp dc681d
  
Karsten Hopp dc681d
      if (our_tv->v_type == VAR_STRING)
Karsten Hopp dc681d
      {
Karsten Hopp dc681d
! 	result = Py_BuildValue("s", our_tv->vval.v_string == NULL
Karsten Hopp dc681d
! 					? "" : (char *)our_tv->vval.v_string);
Karsten Hopp dc681d
      }
Karsten Hopp dc681d
      else if (our_tv->v_type == VAR_NUMBER)
Karsten Hopp dc681d
      {
Karsten Hopp dc681d
***************
Karsten Hopp dc681d
*** 2751,2757 ****
Karsten Hopp dc681d
      switch (tv->v_type)
Karsten Hopp dc681d
      {
Karsten Hopp dc681d
  	case VAR_STRING:
Karsten Hopp dc681d
! 	    return PyBytes_FromString((char *) tv->vval.v_string);
Karsten Hopp dc681d
  	case VAR_NUMBER:
Karsten Hopp dc681d
  	    return PyLong_FromLong((long) tv->vval.v_number);
Karsten Hopp dc681d
  #ifdef FEAT_FLOAT
Karsten Hopp dc681d
--- 2752,2759 ----
Karsten Hopp dc681d
      switch (tv->v_type)
Karsten Hopp dc681d
      {
Karsten Hopp dc681d
  	case VAR_STRING:
Karsten Hopp dc681d
! 	    return PyBytes_FromString(tv->vval.v_string == NULL
Karsten Hopp dc681d
! 					    ? "" : (char *)tv->vval.v_string);
Karsten Hopp dc681d
  	case VAR_NUMBER:
Karsten Hopp dc681d
  	    return PyLong_FromLong((long) tv->vval.v_number);
Karsten Hopp dc681d
  #ifdef FEAT_FLOAT
Karsten Hopp dc681d
***************
Karsten Hopp dc681d
*** 2763,2769 ****
Karsten Hopp dc681d
  	case VAR_DICT:
Karsten Hopp dc681d
  	    return DictionaryNew(tv->vval.v_dict);
Karsten Hopp dc681d
  	case VAR_FUNC:
Karsten Hopp dc681d
! 	    return FunctionNew(tv->vval.v_string);
Karsten Hopp dc681d
  	case VAR_UNKNOWN:
Karsten Hopp dc681d
  	    Py_INCREF(Py_None);
Karsten Hopp dc681d
  	    return Py_None;
Karsten Hopp dc681d
--- 2765,2772 ----
Karsten Hopp dc681d
  	case VAR_DICT:
Karsten Hopp dc681d
  	    return DictionaryNew(tv->vval.v_dict);
Karsten Hopp dc681d
  	case VAR_FUNC:
Karsten Hopp dc681d
! 	    return FunctionNew(tv->vval.v_string == NULL
Karsten Hopp dc681d
! 					  ? (char_u *)"" : tv->vval.v_string);
Karsten Hopp dc681d
  	case VAR_UNKNOWN:
Karsten Hopp dc681d
  	    Py_INCREF(Py_None);
Karsten Hopp dc681d
  	    return Py_None;
Karsten Hopp dc681d
*** ../vim-7.3.682/src/version.c	2012-10-04 22:38:32.000000000 +0200
Karsten Hopp dc681d
--- src/version.c	2012-10-05 21:04:19.000000000 +0200
Karsten Hopp dc681d
***************
Karsten Hopp dc681d
*** 721,722 ****
Karsten Hopp dc681d
--- 721,724 ----
Karsten Hopp dc681d
  {   /* Add new patch number below this line */
Karsten Hopp dc681d
+ /**/
Karsten Hopp dc681d
+     683,
Karsten Hopp dc681d
  /**/
Karsten Hopp dc681d
Karsten Hopp dc681d
-- 
Karsten Hopp dc681d
SIGIRO -- irony detected (iron core dumped)
Karsten Hopp dc681d
Karsten Hopp dc681d
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp dc681d
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp dc681d
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp dc681d
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///