diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-08-24 01:13:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-24 01:13:19 -0400 |
commit | 45ee452751d095d665717bafb61cfd7c65b729b4 (patch) | |
tree | 0f6b6b2c3c71c72aee72f3811ff0e89597ee2b4d /Python | |
parent | ea21206626d0907e0ecfd3efbb186f14f1a8a5d4 (diff) | |
download | cpython-git-45ee452751d095d665717bafb61cfd7c65b729b4.tar.gz |
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 2b824b2538c4a5f9f520c5de8a1eae5a0c181a94)
Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index f19115d2cb..21f6e66d82 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2401,6 +2401,11 @@ builtin_sum(PyObject *self, PyObject *args) continue; } result = PyFloat_FromDouble(f_result); + if (result == NULL) { + Py_DECREF(item); + Py_DECREF(iter); + return NULL; + } temp = PyNumber_Add(result, item); Py_DECREF(result); Py_DECREF(item); |