Index: /trunk/Mars/mcorsika/MCorsikaFormat.cc
===================================================================
--- /trunk/Mars/mcorsika/MCorsikaFormat.cc	(revision 19336)
+++ /trunk/Mars/mcorsika/MCorsikaFormat.cc	(revision 19337)
@@ -122,12 +122,32 @@
                                     Int_t & blockLength) const
 {
-
-    uint32_t blockHeader = fBlockLength;
-    while (blockHeader==fBlockLength)
-    {
-        fIn->read((char*)&blockHeader, 4);
-        if (fIn->eof())
-            return kFALSE;
-    }
+    if (fBlockLength)
+    {
+        // In the new corsika format each block
+        // starts and end with the block length
+        const size_t position = fIn->tellg()%(fBlockLength+8);
+
+        // Whenever we are prior to the end of such a block,
+        // we read and check the end and start tag of this
+        // and the following block
+        if (position==fBlockLength+4)
+        {
+            uint32_t h[2];
+            fIn->read((char*)h, 8);
+            if (fIn->eof())
+                return kFALSE;
+
+            if (h[0]!=fBlockLength || h[1]!=fBlockLength)
+            {
+                gLog << err << "ERROR - Block length missing at the end or beginning of a block." << endl;
+                return kERROR;
+            }
+        }
+    }
+
+    uint32_t blockHeader = 0;
+    fIn->read((char*)&blockHeader, 4);
+    if (fIn->eof())
+        return kFALSE;
 
     blockVersion    = 0;
