--- gdal_virgin/gdal-1.6.2/frmts/cosar/cosar_dataset.cpp	2009-08-21 12:59:29.000000000 +0200
+++ gdal_patched/gdal-1.6.2.1/frmts/cosar/cosar_dataset.cpp	2009-08-21 13:05:55.000000000 +0200
@@ -124,6 +124,12 @@
         ((GUInt32 *)pImage)[i] = 0;
     }
 
+    /* properly account for validity mask */
+    if (nRSFV > 1)
+    {
+    	VSIFSeek(pCDS->fp,(this->nRTNB*(nBlockYOff+4)+(nRSFV+1)*4), SEEK_SET);
+    }
+
     /* Read the valid samples: */
     VSIFRead(((char *)pImage)+((nRSFV - 1)*4),1,((nRSLV-1)*4)-((nRSFV-1)*4),pCDS->fp);
 
