Index: trunk/psModules/src/imcombine/pmSubtraction.c
===================================================================
--- trunk/psModules/src/imcombine/pmSubtraction.c	(revision 14200)
+++ trunk/psModules/src/imcombine/pmSubtraction.c	(revision 14281)
@@ -4,6 +4,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-07-13 22:03:43 $
+ *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-07-18 03:43:49 $
  *
  *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
@@ -463,11 +463,11 @@
 
     // Mask the bad pixels, and around them
-    for (int y = footprint + size; y < numRows - footprint - size; y++) {
+    for (int y = 0; y < numRows; y++) {
         for (int x = 0; x < numCols; x++) {
             if (inData[y][x] & maskVal) {
                 maskData[y][x] |= PM_SUBTRACTION_MASK_INPUT;
                 // Block out the entire stamp footprint around this pixel
-                for (int v = y - footprint; v <= y + footprint; v++) {
-                    for (int u = x - footprint; u <= x + footprint; u++) {
+                for (int v = PS_MAX(y - footprint, 0); v <= PS_MIN(y + footprint, numRows - 1); v++) {
+                    for (int u = PS_MAX(x - footprint, 0); u <= PS_MIN(x + footprint, numCols - 1); u++) {
                         maskData[v][u] |= PM_SUBTRACTION_MASK_FOOTPRINT;
                     }
