@@ -1016,9 +1016,9 @@ public int calcHash(int q1, int q2, int q3)
1016
1016
{ // use same algorithm as multi-byte, tested to work well
1017
1017
int hash = q1 ^ _seed ;
1018
1018
hash += (hash >>> 9 );
1019
- hash *= MULT ;
1019
+ hash *= MULT3 ;
1020
1020
hash += q2 ;
1021
- hash *= MULT2 ;
1021
+ hash *= MULT ;
1022
1022
hash += (hash >>> 15 );
1023
1023
hash ^= q3 ;
1024
1024
// 26-Mar-2015, tatu: As per two-quad case, a short shift seems to help more here
@@ -1183,13 +1183,14 @@ private final int _spilloverStart() {
1183
1183
1184
1184
protected void reportTooManyCollisions ()
1185
1185
{
1186
- // First: do not fuzz about small symbol tables
1187
- if (_hashSize <= 512 ) { // would have spill-over area of 64 entries
1186
+ // First: do not fuzz about small symbol tables; may get balanced by doubling up
1187
+ if (_hashSize <= 1024 ) { // would have spill-over area of 128 entries
1188
1188
return ;
1189
1189
}
1190
1190
throw new IllegalStateException ("Spill-over slots in symbol table with " +_count
1191
1191
+" entries, hash area of " +_hashSize +" slots is now full (all "
1192
- +(_hashSize >> 3 )+" slots -- suspect a DoS attack based on hash collisions" );
1192
+ +(_hashSize >> 3 )+" slots -- suspect a DoS attack based on hash collisions."
1193
+ +" You can disable the check via `JsonFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW`" );
1193
1194
}
1194
1195
1195
1196
static int _calcTertiaryShift (int primarySlots )
@@ -1204,7 +1205,7 @@ static int _calcTertiaryShift(int primarySlots)
1204
1205
if (tertSlots <= 256 ) { // buckets of 8 slots (up to 256 == 32 x 8)
1205
1206
return 5 ;
1206
1207
}
1207
- if (tertSlots <= 2048 ) { // buckets of 16 slots (up to 1024 == 64 x 16)
1208
+ if (tertSlots <= 1024 ) { // buckets of 16 slots (up to 1024 == 64 x 16)
1208
1209
return 6 ;
1209
1210
}
1210
1211
// and biggest buckets have 32 slots
0 commit comments