From 9317ebc83f611075874713a1099b1f5aa14c969c Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 13 Mar 2009 08:55:53 +0200 Subject: [PATCH] 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. --- python/rpmts-py.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/rpmts-py.c b/python/rpmts-py.c index f2056fb..84da9cb 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. */ -- 2.7.4