[PATCH 2/7] web_server/wsgi: Don't segfault when wsgi app doesn't return iterable.

Jelmer Vernooij jelmer at samba.org
Wed Nov 21 18:46:55 MST 2012


There is a bug in the application if this happens, but invalid Python
code shouldn't cause segfaults.
---
 source4/web_server/wsgi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/source4/web_server/wsgi.c b/source4/web_server/wsgi.c
index 37ded29..3f8141c 100644
--- a/source4/web_server/wsgi.c
+++ b/source4/web_server/wsgi.c
@@ -369,6 +369,11 @@ static void wsgi_process_http_input(struct web_server_data *wdata,
 	iter = PyObject_GetIter(result);
 	Py_DECREF(result);
 
+	if (iter == NULL) {
+		DEBUG(0, ("wsgi application did not return iterable\n"));
+		return;
+	}
+
 	/* Now, iter over all the data returned */
 
 	while ((item = PyIter_Next(iter))) {
-- 
1.8.0



More information about the samba-technical mailing list