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