[Kstars-devel] KDE/kdeedu/kstars/kstars

Akarsh Simha akarshsimha at gmail.com
Sun Jun 14 08:54:03 CEST 2009


SVN commit 981686 by asimha:

Adding another error condition to BinFileHelper.

CCMAIL: kstars-devel at kde.org



 M  +6 -1      binfilehelper.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/binfilehelper.cpp #981685:981686
@@ -136,7 +136,7 @@
     // Read the index table
     fread(&indexSize, 4, 1, fileHandle);
     if( byteswap ) indexSize = bswap_32( indexSize );
-
+    
     quint32 ID;
     quint32 offset;
     quint32 prev_offset;
@@ -151,6 +151,11 @@
 
     indexCount.clear();
     indexOffset.clear();
+
+    if( indexSize == 0 ) {
+        errorMessage.sprintf( "Zero index size!" );
+        return ERR_INDEX_TRUNC;
+    }
     for(i = 0; i < indexSize; ++i) {
         if(!fread(&ID, 4, 1, fileHandle)) {
             errorMessage.sprintf("Table truncated before expected! Read i = %d index entries so far", i);


More information about the Kstars-devel mailing list