summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-07-21 02:09:17 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-07-21 02:09:17 +0000
commitedb79679e92ccda68d87a69bb3e291cb2c36f5a5 (patch)
treeff7b9fefaeb64c446bdf318fcedb00c07cbd47ea /numpy/core/src
parentbb8bf82c40ab83d3739b60dd022d6c936cd615c2 (diff)
downloadnumpy-edb79679e92ccda68d87a69bb3e291cb2c36f5a5.tar.gz
Fix up segfault problem in #196
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/arraytypes.inc.src13
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/core/src/arraytypes.inc.src b/numpy/core/src/arraytypes.inc.src
index c126b8580..18a44679e 100644
--- a/numpy/core/src/arraytypes.inc.src
+++ b/numpy/core/src/arraytypes.inc.src
@@ -449,6 +449,13 @@ VOID_getitem(char *ip, PyArrayObject *ap)
}
finish:
+ if (descr->hasobject) {
+ PyErr_SetString(PyExc_ValueError,
+ "tried to get void-array with object"
+ " members as buffer.");
+ return NULL;
+ }
+
itemsize=ap->descr->elsize;
if (PyArray_ISWRITEABLE(ap))
u = PyBuffer_FromReadWriteMemory(ip, itemsize);
@@ -550,6 +557,12 @@ VOID_setitem(PyObject *op, char *ip, PyArrayObject *ap)
{
const void *buffer;
int buflen;
+ if (descr->hasobject) {
+ PyErr_SetString(PyExc_ValueError,
+ "tried to set void-array with object"
+ " members using buffer.");
+ return -1;
+ }
res = PyObject_AsReadBuffer(op, &buffer, &buflen);
if (res == -1) goto fail;
memcpy(ip, buffer, MIN(buflen, itemsize));