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

numpy-svn@scip... numpy-svn@scip...
Sun Apr 1 14:50:01 CDT 2007


Author: oliphant
Date: 2007-04-01 14:49:58 -0500 (Sun, 01 Apr 2007)
New Revision: 3633

Modified:
   trunk/numpy/core/src/arraytypes.inc.src
Log:
Fix segfault in ticket #487

Modified: trunk/numpy/core/src/arraytypes.inc.src
===================================================================
--- trunk/numpy/core/src/arraytypes.inc.src	2007-04-01 04:02:49 UTC (rev 3632)
+++ trunk/numpy/core/src/arraytypes.inc.src	2007-04-01 19:49:58 UTC (rev 3633)
@@ -371,7 +371,7 @@
         int size = ap->descr->elsize;
 
         ptr = ip + size-1;
-        while (*ptr-- == '\0') size--;
+        while (*ptr-- == '\0' && size > 0) size--;
         return PyString_FromStringAndSize(ip,size);
 }
 



More information about the Numpy-svn mailing list