[Enhancement] Validating the .fbi file contents - timestamps should go in ascending order.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2613 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/java/src/com/tightvnc/rfbplayer/FbsConnection.java b/java/src/com/tightvnc/rfbplayer/FbsConnection.java
index 9b38652..5c3ca82 100644
--- a/java/src/com/tightvnc/rfbplayer/FbsConnection.java
+++ b/java/src/com/tightvnc/rfbplayer/FbsConnection.java
@@ -162,6 +162,14 @@
         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");