mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
updated for version 7.4.063
Problem: Crash when using invalid key in Python dictionary. Solution: Check for object to be NULL. Add tests. (ZyX)
This commit is contained in:
@@ -1624,6 +1624,9 @@ DictionaryContains(DictionaryObject *self, PyObject *keyObject)
|
|||||||
PyObject *rObj = _DictionaryItem(self, keyObject, DICT_FLAG_RETURN_BOOL);
|
PyObject *rObj = _DictionaryItem(self, keyObject, DICT_FLAG_RETURN_BOOL);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (rObj == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
ret = (rObj == Py_True);
|
ret = (rObj == Py_True);
|
||||||
|
|
||||||
Py_DECREF(rObj);
|
Py_DECREF(rObj);
|
||||||
|
@@ -1088,6 +1088,9 @@ ee('d.get("a", 2, 3)')
|
|||||||
stringtochars_test('d.get(%s)')
|
stringtochars_test('d.get(%s)')
|
||||||
ee('d.pop("a")')
|
ee('d.pop("a")')
|
||||||
ee('dl.pop("a")')
|
ee('dl.pop("a")')
|
||||||
|
cb.append(">> DictionaryContains")
|
||||||
|
ee('"" in d')
|
||||||
|
ee('0 in d')
|
||||||
cb.append(">> DictionaryIterNext")
|
cb.append(">> DictionaryIterNext")
|
||||||
ee('for i in ned: ned["a"] = 1')
|
ee('for i in ned: ned["a"] = 1')
|
||||||
del i
|
del i
|
||||||
|
@@ -516,6 +516,9 @@ d.get("\0"):TypeError:('expected string without null bytes',)
|
|||||||
<<< Finished
|
<<< Finished
|
||||||
d.pop("a"):KeyError:('a',)
|
d.pop("a"):KeyError:('a',)
|
||||||
dl.pop("a"):error:('dictionary is locked',)
|
dl.pop("a"):error:('dictionary is locked',)
|
||||||
|
>> DictionaryContains
|
||||||
|
"" in d:ValueError:('empty keys are not allowed',)
|
||||||
|
0 in d:TypeError:('expected str() or unicode() instance, but got int',)
|
||||||
>> DictionaryIterNext
|
>> DictionaryIterNext
|
||||||
for i in ned: ned["a"] = 1:RuntimeError:('hashtab changed during iteration',)
|
for i in ned: ned["a"] = 1:RuntimeError:('hashtab changed during iteration',)
|
||||||
>> DictionaryAssItem
|
>> DictionaryAssItem
|
||||||
|
@@ -1039,6 +1039,9 @@ ee('d.get("a", 2, 3)')
|
|||||||
stringtochars_test('d.get(%s)')
|
stringtochars_test('d.get(%s)')
|
||||||
ee('d.pop("a")')
|
ee('d.pop("a")')
|
||||||
ee('dl.pop("a")')
|
ee('dl.pop("a")')
|
||||||
|
cb.append(">> DictionaryContains")
|
||||||
|
ee('"" in d')
|
||||||
|
ee('0 in d')
|
||||||
cb.append(">> DictionaryIterNext")
|
cb.append(">> DictionaryIterNext")
|
||||||
ee('for i in ned: ned["a"] = 1')
|
ee('for i in ned: ned["a"] = 1')
|
||||||
del i
|
del i
|
||||||
|
@@ -505,6 +505,9 @@ d.get("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
|
|||||||
<<< Finished
|
<<< Finished
|
||||||
d.pop("a"):(<class 'KeyError'>, KeyError('a',))
|
d.pop("a"):(<class 'KeyError'>, KeyError('a',))
|
||||||
dl.pop("a"):(<class 'vim.error'>, error('dictionary is locked',))
|
dl.pop("a"):(<class 'vim.error'>, error('dictionary is locked',))
|
||||||
|
>> DictionaryContains
|
||||||
|
"" in d:(<class 'ValueError'>, ValueError('empty keys are not allowed',))
|
||||||
|
0 in d:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
|
||||||
>> DictionaryIterNext
|
>> DictionaryIterNext
|
||||||
for i in ned: ned["a"] = 1:(<class 'RuntimeError'>, RuntimeError('hashtab changed during iteration',))
|
for i in ned: ned["a"] = 1:(<class 'RuntimeError'>, RuntimeError('hashtab changed during iteration',))
|
||||||
>> DictionaryAssItem
|
>> DictionaryAssItem
|
||||||
|
@@ -738,6 +738,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
63,
|
||||||
/**/
|
/**/
|
||||||
62,
|
62,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user