Skip to content

Commit 7d470f3

Browse files
miss-islingtonAlexey Izbyshev
andauthored
closes bpo-34474: Python/bltinmodule.c: Add missing NULL check in builtin_sum_impl() (GH-8872)
Reported by Svace static analyzer. (cherry picked from commit 2b824b2) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
1 parent fbe359a commit 7d470f3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Python/bltinmodule.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2343,6 +2343,11 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
23432343
}
23442344
}
23452345
result = PyFloat_FromDouble(f_result);
2346+
if (result == NULL) {
2347+
Py_DECREF(item);
2348+
Py_DECREF(iter);
2349+
return NULL;
2350+
}
23462351
temp = PyNumber_Add(result, item);
23472352
Py_DECREF(result);
23482353
Py_DECREF(item);

0 commit comments

Comments
 (0)