changeset 751:98d2e1de11bb

Fixed array boundary error on 1d array retrieval
author mas01mc
date Thu, 25 Nov 2010 02:30:53 +0000
parents d93292ae7c1b
children 9d32eea0cd78
files bindings/python/pyadbmodule.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/bindings/python/pyadbmodule.c	Wed Nov 24 19:29:52 2010 +0000
+++ b/bindings/python/pyadbmodule.c	Thu Nov 25 02:30:53 2010 +0000
@@ -1011,7 +1011,7 @@
 	if(features){
 	  if(ins->dim>1){
 	    dims=2;
-	    shape[1]= ins->dim;	    
+	    shape[1]= ins->dim;
 	  }
 	  else{
 	    dims=1;
@@ -1042,7 +1042,10 @@
 	/* Copy the data, this allows us to free the allocated memory and let
 	 * python do the subsequent garbage collection itself.
 	 */
-	int num_items = ins->nvectors * ins->dim;
+	int num_items = ins->nvectors;
+	if(dims>1){
+	  num_items *= shape[1];
+	}		    
 	double* p = (double*) PyArray_DATA(outgoing);
 	double* d = data;
 	while(num_items--)