[Numpy-svn] r3631 - trunk/numpy/core/src

numpy-svn@scip... numpy-svn@scip...
Sat Mar 31 22:44:30 CDT 2007


Author: oliphant
Date: 2007-03-31 22:44:27 -0500 (Sat, 31 Mar 2007)
New Revision: 3631

Modified:
   trunk/numpy/core/src/multiarraymodule.c
Log:
Make sure dot product is not too large for dimensions array in PyArray_MatrixProduct.  Fixes ticket #418

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2007-04-01 02:35:36 UTC (rev 3630)
+++ trunk/numpy/core/src/multiarraymodule.c	2007-04-01 03:44:27 UTC (rev 3631)
@@ -3287,6 +3287,11 @@
 	}
 
 	nd = ap1->nd+ap2->nd-2;
+        if (nd > NPY_MAXDIMS) {
+                PyErr_SetString(PyExc_ValueError, 
+                                "dot: too many dimensions in result");
+                goto fail;
+        }
 	j = 0;
 	for(i=0; i<ap1->nd-1; i++) {
 		dimensions[j++] = ap1->dimensions[i];



More information about the Numpy-svn mailing list