]> granicus.if.org Git - python/commitdiff
Add test for failure of the getattr call in pcre_expand() -- it used
authorGuido van Rossum <guido@python.org>
Fri, 17 Jul 1998 20:19:48 +0000 (20:19 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 17 Jul 1998 20:19:48 +0000 (20:19 +0000)
to core dump if the first argument did not have a "group" attribute.

Modules/pcremodule.c

index 60b702993b2a30e72f796fc038a2f9b752ca5ae9..f8bde043604ab9f34f16273bd093203073d0ac14 100644 (file)
@@ -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);