mirror of
https://github.com/i2p/i2p.i2p.git
synced 2026-08-15 04:49:50 +00:00
NetDB: Prevent ClassCastException in HFDSMJ on hash collision
This commit is contained in:
+9
-1
@@ -249,7 +249,15 @@ class HandleFloodfillDatabaseStoreMessageJob extends JobImpl {
|
||||
boolean shouldStore = true;
|
||||
if (ri.getReceivedAsPublished()) {
|
||||
// these are often just dup stores from concurrent lookups
|
||||
prevNetDb = (RouterInfo) _facade.lookupLocallyWithoutValidation(key);
|
||||
DatabaseEntry dbe = _facade.lookupLocallyWithoutValidation(key);
|
||||
if (dbe != null) {
|
||||
if (dbe.getType() != DatabaseEntry.KEY_TYPE_ROUTERINFO) {
|
||||
// hash collision
|
||||
// prevent ClassCastException here
|
||||
throw new IllegalArgumentException("Attempt to replace LS with " + ri);
|
||||
}
|
||||
prevNetDb = (RouterInfo) dbe;
|
||||
}
|
||||
if (prevNetDb == null) {
|
||||
// actually new
|
||||
int count = _facade.getDataStore().size();
|
||||
|
||||
Reference in New Issue
Block a user