summaryrefslogtreecommitdiff
path: root/c/lib_obj.c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2015-05-28 13:34:43 +0200
committerArmin Rigo <arigo@tunes.org>2015-05-28 13:34:43 +0200
commita985b3dcc13e25a3bd69011213f35260f73cba2a (patch)
tree0564b458cec1ad20f7e01ab83faba486802c205c /c/lib_obj.c
parent9dfb33d6e40c27d446ad208ac9ce2bf2cf5fccc4 (diff)
downloadcffi-a985b3dcc13e25a3bd69011213f35260f73cba2a.tar.gz
Issue #198 bis: fix for constants of unknown size
Diffstat (limited to 'c/lib_obj.c')
-rw-r--r--c/lib_obj.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/c/lib_obj.c b/c/lib_obj.c
index 0f8ec4a..8e122f7 100644
--- a/c/lib_obj.c
+++ b/c/lib_obj.c
@@ -259,7 +259,10 @@ static PyObject *lib_build_and_cache_attr(LibObject *lib, PyObject *name,
return NULL;
assert(g->address);
- assert(ct->ct_size > 0);
+ if (ct->ct_size <= 0) {
+ PyErr_SetString(PyExc_SystemError, "constant has no known size");
+ return NULL;
+ }
/* xxx the few bytes of memory we allocate here leak, but it's
a minor concern because it should only occur for
OP_CONSTANT. There is one per real non-integer C constant