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