commit cdd03bc42f9277d97442e0a7952014623e1378e9 Author: David Malcolm dmalcolm@redhat.com Date: Mon Sep 26 17:36:57 2011 -0400
cpychecker: PyList_SetItem: warn if the list is NULL
libcpychecker/refcounts.py | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) --- diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py index e74000f..57307d8 100644 --- a/libcpychecker/refcounts.py +++ b/libcpychecker/refcounts.py @@ -1023,8 +1023,15 @@ class CPython(Facet): def impl_PyList_SetItem(self, stmt, v_list, v_index, v_item): # Decl: # int PyList_SetItem(PyObject *list, Py_ssize_t index, PyObject *item) + # http://docs.python.org/c-api/list.html#PyList_SetItem fnname = stmt.fn.operand.name
+ # It uses Py_List_Check, a macro which uses Py_TYPE(op) without + # checking op; hence it will segfault will a NULL "list" pointer + self.state.raise_any_null_ptr_func_arg(stmt, 0, v_list) + + # However, it appears to be robust in the face of NULL "item" pointers + result = []
# Is it really a list?
gcc-python-plugin-commits@lists.stg.fedorahosted.org