diff options
author | Guido van Rossum <guido@python.org> | 1998-07-17 20:19:48 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-07-17 20:19:48 (GMT) |
commit | 1a7855309322a7dcbf7d7ee3356fe693ffb5b336 (patch) | |
tree | b3fc59365b07e8fd5b50416cc62b253e7a69f010 /Modules/pcremodule.c | |
parent | 0e5ab17ad34c8810f0626409fd3d1c8dc85e68ac (diff) | |
download | cpython-1a7855309322a7dcbf7d7ee3356fe693ffb5b336.zip cpython-1a7855309322a7dcbf7d7ee3356fe693ffb5b336.tar.gz cpython-1a7855309322a7dcbf7d7ee3356fe693ffb5b336.tar.bz2 |
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.
Diffstat (limited to 'Modules/pcremodule.c')
-rw-r--r-- | Modules/pcremodule.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/pcremodule.c b/Modules/pcremodule.c index 60b7029..f8bde04 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); |