summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-02-21 16:49:51 +0200
committerPanu Matilainen <pmatilai@redhat.com>2012-02-21 16:49:51 +0200
commitde942fba1cb7b1873e8813732f12a5475965c2ff (patch)
treec1db2f4f1704dd7f1801dcb76e5d35cb7de60cc1 /python
parent97e72eaaea49008a2f05b806f95be0db3db3ad95 (diff)
downloadlibrpm-tizen-de942fba1cb7b1873e8813732f12a5475965c2ff.tar.gz
librpm-tizen-de942fba1cb7b1873e8813732f12a5475965c2ff.tar.bz2
librpm-tizen-de942fba1cb7b1873e8813732f12a5475965c2ff.zip
Raise exception in python on headerGet() invalid data failure
Diffstat (limited to 'python')
-rw-r--r--python/header-py.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/header-py.c b/python/header-py.c
index 26103445f..d194fdcf7 100644
--- a/python/header-py.c
+++ b/python/header-py.c
@@ -481,9 +481,13 @@ static PyObject * hdrGetTag(Header h, rpmTagVal tag)
PyObject *res = NULL;
struct rpmtd_s td;
- /* rpmtd_AsPyobj() knows how to handle empty containers and all */
(void) headerGet(h, tag, &td, HEADERGET_EXT);
- res = rpmtd_AsPyobj(&td);
+ if (rpmtdGetFlags(&td) & RPMTD_INVALID) {
+ PyErr_SetString(pyrpmError, "invalid header data");
+ } else {
+ /* rpmtd_AsPyobj() knows how to handle empty containers and all */
+ res = rpmtd_AsPyobj(&td);
+ }
rpmtdFreeData(&td);
return res;
}