Skip to content

Commit 1a78553

Browse files
committed
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.
1 parent 0e5ab17 commit 1a78553

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Modules/pcremodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,10 @@ PyPcre_expand(self, args)
512512
{
513513
PyObject *r, *tuple, *result;
514514
r=PyObject_GetAttrString(match_obj, "group");
515+
if (r == NULL) {
516+
Py_DECREF(results);
517+
return NULL;
518+
}
515519
tuple=PyTuple_New(1);
516520
Py_INCREF(value);
517521
PyTuple_SetItem(tuple, 0, value);

0 commit comments

Comments
 (0)