Skip to content

Commit f62dbc1

Browse files
author
Luke Lovett
committed
PYTHON-969 - Check return value from PyObject_Call before using it in PyObject_GetAttrString.
1 parent 07ff7ea commit f62dbc1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bson/_cbsonmodule.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,12 @@ static PyObject* get_value(PyObject* self, const char* buffer,
19121912
}
19131913
Py_XDECREF(utc_type);
19141914
value = PyObject_Call(replace, args, kwargs);
1915+
if (!value) {
1916+
Py_DECREF(replace);
1917+
Py_DECREF(args);
1918+
Py_DECREF(kwargs);
1919+
goto invalid;
1920+
}
19151921

19161922
/* convert to local time */
19171923
if (options->tzinfo != Py_None) {

0 commit comments

Comments
 (0)