From: Guido van Rossum Date: Fri, 17 Jul 1998 20:19:48 +0000 (+0000) Subject: Add test for failure of the getattr call in pcre_expand() -- it used X-Git-Tag: v1.5.2a1~292 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1a7855309322a7dcbf7d7ee3356fe693ffb5b336;p=thirdparty%2FPython%2Fcpython.git Add test for failure of the getattr call in pcre_expand() -- it used to core dump if the first argument did not have a "group" attribute. --- diff --git a/Modules/pcremodule.c b/Modules/pcremodule.c index 60b702993b2a..f8bde043604a 100644 --- a/Modules/pcremodule.c +++ b/Modules/pcremodule.c @@ -512,6 +512,10 @@ PyPcre_expand(self, args) { PyObject *r, *tuple, *result; r=PyObject_GetAttrString(match_obj, "group"); + if (r == NULL) { + Py_DECREF(results); + return NULL; + } tuple=PyTuple_New(1); Py_INCREF(value); PyTuple_SetItem(tuple, 0, value);