diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-03-13 15:26:32 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-03-13 15:26:32 -0400 |
commit | 5cd72c7a7c7bd76ab028e1dc59d90a47750acebe (patch) | |
tree | c8200b31b4b15951a16a5cb0bb42f9805360574d /src/pl/plpython/plpy_elog.c | |
parent | a14fa84693659c4c4a17204406945b29fae3d9c4 (diff) | |
download | postgresql-5cd72c7a7c7bd76ab028e1dc59d90a47750acebe.tar.gz postgresql-5cd72c7a7c7bd76ab028e1dc59d90a47750acebe.zip |
Patch some corner-case bugs in pl/python.
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
Diffstat (limited to 'src/pl/plpython/plpy_elog.c')
-rw-r--r-- | src/pl/plpython/plpy_elog.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; |