summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-03-13 08:55:53 +0200
committerPanu Matilainen <pmatilai@redhat.com>2009-03-13 08:55:53 +0200
commit9317ebc83f611075874713a1099b1f5aa14c969c (patch)
treee38024f9351bf7d274d5270d405cd31083790bd7 /python
parentffe2f39adaea9f113a73aea4537a930ba99e49ff (diff)
downloadlibrpm-tizen-9317ebc83f611075874713a1099b1f5aa14c969c.tar.gz
librpm-tizen-9317ebc83f611075874713a1099b1f5aa14c969c.tar.bz2
librpm-tizen-9317ebc83f611075874713a1099b1f5aa14c969c.zip
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.
Diffstat (limited to 'python')
-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 f2056fbc0..84da9cb0e 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -1111,6 +1111,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. */