3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.063
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.063
3ef2ca
Problem:    Crash when using invalid key in Python dictionary.
3ef2ca
Solution:   Check for object to be NULL.  Add tests. (ZyX)
3ef2ca
Files:      src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok,
3ef2ca
            src/testdir/test87.in, src/testdir/test87.ok
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.062/src/if_py_both.h	2013-07-24 17:09:19.000000000 +0200
3ef2ca
--- src/if_py_both.h	2013-11-04 00:27:40.000000000 +0100
3ef2ca
***************
3ef2ca
*** 1624,1629 ****
3ef2ca
--- 1624,1632 ----
3ef2ca
      PyObject	*rObj = _DictionaryItem(self, keyObject, DICT_FLAG_RETURN_BOOL);
3ef2ca
      int		ret;
3ef2ca
  
3ef2ca
+     if (rObj == NULL)
3ef2ca
+ 	return -1;
3ef2ca
+ 
3ef2ca
      ret = (rObj == Py_True);
3ef2ca
  
3ef2ca
      Py_DECREF(rObj);
3ef2ca
*** ../vim-7.4.062/src/testdir/test86.in	2013-07-13 14:00:31.000000000 +0200
3ef2ca
--- src/testdir/test86.in	2013-11-04 00:27:11.000000000 +0100
3ef2ca
***************
3ef2ca
*** 1088,1093 ****
3ef2ca
--- 1088,1096 ----
3ef2ca
  stringtochars_test('d.get(%s)')
3ef2ca
  ee('d.pop("a")')
3ef2ca
  ee('dl.pop("a")')
3ef2ca
+ cb.append(">> DictionaryContains")
3ef2ca
+ ee('"" in d')
3ef2ca
+ ee('0 in d')
3ef2ca
  cb.append(">> DictionaryIterNext")
3ef2ca
  ee('for i in ned: ned["a"] = 1')
3ef2ca
  del i
3ef2ca
*** ../vim-7.4.062/src/testdir/test86.ok	2013-06-23 16:38:39.000000000 +0200
3ef2ca
--- src/testdir/test86.ok	2013-11-04 00:27:11.000000000 +0100
3ef2ca
***************
3ef2ca
*** 516,521 ****
3ef2ca
--- 516,524 ----
3ef2ca
  <<< Finished
3ef2ca
  d.pop("a"):KeyError:('a',)
3ef2ca
  dl.pop("a"):error:('dictionary is locked',)
3ef2ca
+ >> DictionaryContains
3ef2ca
+ "" in d:ValueError:('empty keys are not allowed',)
3ef2ca
+ 0 in d:TypeError:('expected str() or unicode() instance, but got int',)
3ef2ca
  >> DictionaryIterNext
3ef2ca
  for i in ned: ned["a"] = 1:RuntimeError:('hashtab changed during iteration',)
3ef2ca
  >> DictionaryAssItem
3ef2ca
*** ../vim-7.4.062/src/testdir/test87.in	2013-07-06 13:41:30.000000000 +0200
3ef2ca
--- src/testdir/test87.in	2013-11-04 00:27:11.000000000 +0100
3ef2ca
***************
3ef2ca
*** 1039,1044 ****
3ef2ca
--- 1039,1047 ----
3ef2ca
  stringtochars_test('d.get(%s)')
3ef2ca
  ee('d.pop("a")')
3ef2ca
  ee('dl.pop("a")')
3ef2ca
+ cb.append(">> DictionaryContains")
3ef2ca
+ ee('"" in d')
3ef2ca
+ ee('0 in d')
3ef2ca
  cb.append(">> DictionaryIterNext")
3ef2ca
  ee('for i in ned: ned["a"] = 1')
3ef2ca
  del i
3ef2ca
*** ../vim-7.4.062/src/testdir/test87.ok	2013-06-23 16:38:39.000000000 +0200
3ef2ca
--- src/testdir/test87.ok	2013-11-04 00:27:11.000000000 +0100
3ef2ca
***************
3ef2ca
*** 505,510 ****
3ef2ca
--- 505,513 ----
3ef2ca
  <<< Finished
3ef2ca
  d.pop("a"):(<class 'KeyError'>, KeyError('a',))
3ef2ca
  dl.pop("a"):(<class 'vim.error'>, error('dictionary is locked',))
3ef2ca
+ >> DictionaryContains
3ef2ca
+ "" in d:(<class 'ValueError'>, ValueError('empty keys are not allowed',))
3ef2ca
+ 0 in d:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
3ef2ca
  >> DictionaryIterNext
3ef2ca
  for i in ned: ned["a"] = 1:(<class 'RuntimeError'>, RuntimeError('hashtab changed during iteration',))
3ef2ca
  >> DictionaryAssItem
3ef2ca
*** ../vim-7.4.062/src/version.c	2013-11-03 20:26:27.000000000 +0100
3ef2ca
--- src/version.c	2013-11-04 00:26:39.000000000 +0100
3ef2ca
***************
3ef2ca
*** 740,741 ****
3ef2ca
--- 740,743 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     63,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
A parent can be arrested if his child cannot hold back a burp during a church
3ef2ca
service.
3ef2ca
		[real standing law in Nebraska, United States of America]
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///