Index: /trunk/psLib/src/mathtypes/psImage.c
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.c	(revision 7618)
+++ /trunk/psLib/src/mathtypes/psImage.c	(revision 7619)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.107 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-06-15 02:29:12 $
+ *  @version $Revision: 1.108 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-06-21 22:46:02 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -23,4 +23,5 @@
 #include "psMemory.h"
 #include "psError.h"
+#include "psAbort.h"
 #include "psImage.h"
 #include "psString.h"
@@ -58,11 +59,8 @@
                       psElemType type)
 {
-    psS32 area = 0;
-    psS32 elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
-    psS32 rowSize = numCols * elementSize;        // row size in bytes.
-
-    area = numCols * numRows;
-
-    if (area < 1) {
+    int elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
+    int rowSize = numCols * elementSize;        // row size in bytes.
+
+    if (numRows < 1) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
                 PS_ERRORTEXT_psImage_AREA_NEGATIVE,
@@ -70,4 +68,12 @@
         return NULL;
     }
+    if (numCols < 1) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                PS_ERRORTEXT_psImage_AREA_NEGATIVE,
+                numRows, numCols);
+        return NULL;
+    }
+
+    long numBytes = numRows * numCols * elementSize;
 
     psImage* image = (psImage* ) psAlloc(sizeof(psImage));
@@ -77,5 +83,5 @@
     image->data.V = psAlloc(sizeof(psPtr ) * numRows);
 
-    image->p_rawDataBuffer = psAlloc(area * elementSize);
+    image->p_rawDataBuffer = psAlloc(numBytes);
 
     // set the row pointers.
@@ -249,5 +255,6 @@
             NATIVETYPE temp = va_arg (argp, NATIVETYPE); \
             if ( temp < PS_MIN_##TTT || temp > PS_MAX_##TTT ) { \
-                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: Value out of Range.\n"); \
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: Value %d out of Range.\n", temp); \
+                psAbort("pslib", "trapping bad value"); \
                 return false; \
             } \
