From 5cd72c7a7c7bd76ab028e1dc59d90a47750acebe Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 13 Mar 2012 15:26:32 -0400 Subject: Patch some corner-case bugs in pl/python. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dave Malcolm of Red Hat is working on a static code analysis tool for Python-related C code. It reported a number of problems in plpython, most of which were failures to check for NULL results from object-creation functions, so would only be an issue in very-low-memory situations. Patch in HEAD and 9.1. We could go further back but it's not clear that these issues are important enough to justify the work. Jan UrbaƄski --- src/pl/plpython/plpy_elog.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/pl/plpython/plpy_elog.c') diff --git a/src/pl/plpython/plpy_elog.c b/src/pl/plpython/plpy_elog.c index 2f04a8c0dba..f7d321289d4 100644 --- a/src/pl/plpython/plpy_elog.c +++ b/src/pl/plpython/plpy_elog.c @@ -367,6 +367,10 @@ get_source_line(const char *src, int lineno) const char *next = src; int current = 0; + /* sanity check */ + if (lineno <= 0) + return NULL; + while (current < lineno) { s = next; -- cgit v1.2.3