diff options
author | Guido van Rossum <guido@python.org> | 1998-07-17 20:19:48 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-07-17 20:19:48 +0000 |
commit | 827a53bbc981292f365a2dea2978e8ce0b85acc8 (patch) | |
tree | 6ce7db3b042885d047e2674ea4edb1d9d2abe49e /Modules/pcremodule.c | |
parent | ad1ad540a82e70196d85ec850e308176bd23d888 (diff) | |
download | cpython-827a53bbc981292f365a2dea2978e8ce0b85acc8.tar.gz |
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 60b702993b..f8bde04360 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); |