]> source.dussan.org Git - tigervnc.git/commitdiff
[Enhancement] Validating the .fbi file contents - timestamps should go in ascending...
authorConstantin Kaplinsky <const@tightvnc.com>
Mon, 23 Jun 2008 01:32:53 +0000 (01:32 +0000)
committerConstantin Kaplinsky <const@tightvnc.com>
Mon, 23 Jun 2008 01:32:53 +0000 (01:32 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2613 3789f03b-4d11-0410-bbf8-ca57d06f2519

java/src/com/tightvnc/rfbplayer/FbsConnection.java

index 9b38652ed27f9287d73ea86a4bfd683949a717fe..5c3ca82b6b19eed5ec6310e58ab031cde7e83308 100644 (file)
@@ -162,6 +162,14 @@ public class FbsConnection {
         System.err.println("Could not load index: failed to load .fbi file");
         return;
       }
+      // Check correctness of the data read.
+      for (int i = 1; i < numRecordsRead; i++) {
+        if (newIndex[i].timestamp <= newIndex[i-1].timestamp) {
+          System.err.println("Could not load index: wrong .fbi file contents");
+          return;
+        }
+      }
+      // Loaded successfully.
       indexData = newIndex;
       numIndexRecords = numRecordsRead;
       System.err.println("Loaded index data, " + numRecordsRead + " records");