Index: branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 673)
+++ branches/SHM-6-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 674)
@@ -977,9 +977,16 @@
     }
   }
+
+#if VPS_EXTNS
   READ_FLAG( uiCode,  "vps_extension_flag" );      pcVPS->setVpsExtensionFlag( uiCode ? true : false );
 
+  // When MaxLayersMinus1 is greater than 0, vps_extension_flag shall be equal to 1.
+  if( pcVPS->getMaxLayers() > 1 )
+  {
+    assert( pcVPS->getVpsExtensionFlag() == true );
+  }
+
   if( pcVPS->getVpsExtensionFlag()  )
   {
-#if VPS_EXTNS
     while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
     {
@@ -995,10 +1002,4 @@
       }
     }
-#else
-    while ( xMoreRbspData() )
-    {
-      READ_FLAG( uiCode, "vps_extension_data_flag");
-    }
-#endif
   }
   else
@@ -1007,4 +1008,14 @@
     defaultVPSExtension(pcVPS);    
   }
+#else
+  READ_FLAG( uiCode,  "vps_extension_flag" );
+  if (uiCode)
+  {
+    while ( xMoreRbspData() )
+    {
+      READ_FLAG( uiCode, "vps_extension_data_flag");
+    }
+  }
+#endif
 
   return;
