| To: vim_dev@googlegroups.com |
| Subject: Patch 7.4.063 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.4.063 |
| Problem: Crash when using invalid key in Python dictionary. |
| Solution: Check for object to be NULL. Add tests. (ZyX) |
| Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok, |
| src/testdir/test87.in, src/testdir/test87.ok |
| |
| |
| |
| |
| |
| *** 1624,1629 **** |
| --- 1624,1632 ---- |
| PyObject *rObj = _DictionaryItem(self, keyObject, DICT_FLAG_RETURN_BOOL); |
| int ret; |
| |
| + if (rObj == NULL) |
| + return -1; |
| + |
| ret = (rObj == Py_True); |
| |
| Py_DECREF(rObj); |
| |
| |
| |
| *** 1088,1093 **** |
| --- 1088,1096 ---- |
| stringtochars_test('d.get(%s)') |
| ee('d.pop("a")') |
| ee('dl.pop("a")') |
| + cb.append(">> DictionaryContains") |
| + ee('"" in d') |
| + ee('0 in d') |
| cb.append(">> DictionaryIterNext") |
| ee('for i in ned: ned["a"] = 1') |
| del i |
| |
| |
| |
| *** 516,521 **** |
| --- 516,524 ---- |
| <<< Finished |
| d.pop("a"):KeyError:('a',) |
| 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 |
| for i in ned: ned["a"] = 1:RuntimeError:('hashtab changed during iteration',) |
| >> DictionaryAssItem |
| |
| |
| |
| *** 1039,1044 **** |
| --- 1039,1047 ---- |
| stringtochars_test('d.get(%s)') |
| ee('d.pop("a")') |
| ee('dl.pop("a")') |
| + cb.append(">> DictionaryContains") |
| + ee('"" in d') |
| + ee('0 in d') |
| cb.append(">> DictionaryIterNext") |
| ee('for i in ned: ned["a"] = 1') |
| del i |
| |
| |
| |
| *** 505,510 **** |
| --- 505,513 ---- |
| <<< Finished |
| d.pop("a"):(<class 'KeyError'>, KeyError('a',)) |
| 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 |
| for i in ned: ned["a"] = 1:(<class 'RuntimeError'>, RuntimeError('hashtab changed during iteration',)) |
| >> DictionaryAssItem |
| |
| |
| |
| *** 740,741 **** |
| --- 740,743 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 63, |
| /**/ |
| |
| -- |
| A parent can be arrested if his child cannot hold back a burp during a church |
| service. |
| [real standing law in Nebraska, United States of America] |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ an exciting new programming language -- http://www.Zimbu.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |