Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed a bad chunkcache limit check which could have caused ArrayIndexOutOfBoundsExceptions
orbiter93376acdcae9
diff --git a/source/de/anomic/kelondro/kelondroRowCollection.java b/source/de/anomic/kelondro/kelondroRowCollection.javaindex a6bac0988..08a090687 100644--- a/source/de/anomic/kelondro/kelondroRowCollection.java+++ b/source/de/anomic/kelondro/kelondroRowCollection.java@@ -257,7 +257,7 @@ public class kelondroRowCollection {assert (index * rowdef.objectsize < chunkcache.length);if ((chunkcache == null) || (rowdef == null)) return null; // case may appear during shutdownif (index >= chunkcount) return null;- if (index * rowdef.objectsize >= chunkcache.length) return null;+ if ((index + 1) * rowdef.objectsize > chunkcache.length) return null; // the whole chunk does not fit into the chunkcachethis.lastTimeRead = System.currentTimeMillis();byte[] b = new byte[this.rowdef.width(0)];System.arraycopy(chunkcache, index * rowdef.objectsize, b, 0, b.length);@@ -270,7 +270,7 @@ public class kelondroRowCollection {assert (index * rowdef.objectsize < chunkcache.length);if ((chunkcache == null) || (rowdef == null)) return null; // case may appear during shutdownif (index >= chunkcount) return null;- if (index * rowdef.objectsize >= chunkcache.length) return null;+ if ((index + 1) * rowdef.objectsize > chunkcache.length) return null; // the whole chunk does not fit into the chunkcachethis.lastTimeRead = System.currentTimeMillis();return rowdef.newEntry(chunkcache, index * rowdef.objectsize, true);}