Index: trunk/psLib/src/imageops/psImageStructManip.c
===================================================================
--- trunk/psLib/src/imageops/psImageStructManip.c	(revision 3977)
+++ trunk/psLib/src/imageops/psImageStructManip.c	(revision 4540)
@@ -8,6 +8,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-05-19 05:18:20 $
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-12 19:12:01 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -31,5 +31,15 @@
 {
     psU32 elementSize;          // size of image element in bytes
-    psU32 inputColOffset;       // offset in bytes to first subset pixel in input row
+    psS32 inputColOffset;       // offset in bytes to first subset pixel in input row
+
+    if ( col0 < 0 || row0 < 0 ) {
+        //        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+        //                PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID);
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
+                col0, col1-1, row0, row1-1,
+                image->numCols-1, image->numRows-1);
+        return NULL;
+    }
 
     if (image == NULL || image->data.V == NULL) {
@@ -64,4 +74,7 @@
         return NULL;
     }
+
+
+
     psS32 numRows = row1-row0;
     psS32 numCols = col1-col0;
@@ -94,7 +107,9 @@
 
     out->data.V = psRealloc(out->data.V,sizeof(psPtr)*numRows); // resize row pointer array
-    *(psType*)&out->type = image->type;
-    *(psU32*)&out->numCols = numCols;
-    *(psU32*)&out->numRows = numRows;
+    *(psMathType*)&out->type = image->type;
+    //    *(psU32*)&out->numCols = numCols;
+    //    *(psU32*)&out->numRows = numRows;
+    *(psS32*)&out->numCols = numCols;
+    *(psS32*)&out->numRows = numRows;
     *(psS32*)&out->row0 = row0;
     *(psS32*)&out->col0 = col0;
