summaryrefslogtreecommitdiff
path: root/Modules/pcremodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-07-17 20:19:48 +0000
committerGuido van Rossum <guido@python.org>1998-07-17 20:19:48 +0000
commit827a53bbc981292f365a2dea2978e8ce0b85acc8 (patch)
tree6ce7db3b042885d047e2674ea4edb1d9d2abe49e /Modules/pcremodule.c
parentad1ad540a82e70196d85ec850e308176bd23d888 (diff)
downloadcpython-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.c4
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);