summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-03-13 08:55:53 +0200
committerPanu Matilainen <pmatilai@redhat.com>2009-04-16 15:15:46 +0300
commit4240c7b6cca087bd0f5bfbd37412454df74b3e92 (patch)
tree17a28c136ef51a40affab7c3f00f31609cc3a607
parentc9256a29f797e6f01a1d9c872ae7bfb57f7b9fda (diff)
downloadrpm-4240c7b6cca087bd0f5bfbd37412454df74b3e92.tar.gz
Catch exceptions from python conversions in dbMatch()
- Prior to this, string conversion (eg on unicode object) could fall through to rpmtsInitIterator() with key of NULL, matching everything and only much later spitting out an obscure traceback. PyInt_FromLong() can fail too, causing us to look for bogons. (cherry picked from commit 9317ebc83f611075874713a1099b1f5aa14c969c)
-rw-r--r--python/rpmts-py.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index 244b49a2d..0d7efadb9 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -1115,6 +1115,10 @@ fprintf(stderr, "*** rpmts_Match(%p) ts %p\n", s, s->ts);
PyErr_SetString(PyExc_TypeError, "unknown key type");
return NULL;
}
+ /* One of the conversions above failed, exception is set already */
+ if (PyErr_Occurred()) {
+ return NULL;
+ }
}
/* XXX If not already opened, open the database O_RDONLY now. */