kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit a7aa51d8d57a698a5780556e054b2374c48ed5cf
parent daca80f1cb25735ff992ecf87ab67c29e7bed98b
Author: Joris Vink <joris@coders.se>
Date:   Sun, 20 Feb 2022 21:25:18 +0100

Fix unhappy path cleanup.

The whole while (cnt-- >= 0) idiom is busted since cnt started
at 0 and if the first call to PyUnicode_FromStringAndSize() fails
then we're attempting to access -1.

Diffstat:
src/python.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/python.c b/src/python.c @@ -1274,8 +1274,8 @@ python_runtime_http_request(void *addr, struct http_request *req) req->cgroups[idx].rm_eo - req->cgroups[idx].rm_so); if (cargs[cnt] == NULL) { - while (cnt-- >= 0) - Py_XDECREF(cargs[cnt]); + while (cnt >= 0) + Py_XDECREF(cargs[cnt--]); kore_python_log_error("http request"); http_response(req, HTTP_STATUS_INTERNAL_ERROR, NULL, 0);