3b5d6dd8bfe74dcde5738098211ce47b55f9ab23
braney
  Mon Feb 9 12:02:35 2015 -0800
don't crash if the maximum size of a hash table is reached.

diff --git src/lib/hash.c src/lib/hash.c
index 770647f..71ec77a 100644
--- src/lib/hash.c
+++ src/lib/hash.c
@@ -368,30 +368,35 @@
 hash->mask = hash->size-1;
 AllocArray(hash->table, hash->size);
 hash->autoExpand = TRUE;
 hash->expansionFactor = defaultExpansionFactor;   /* Expand when elCount > size*expansionFactor */
 return hash;
 }
 
 void hashResize(struct hash *hash, int powerOfTwoSize)
 /* Resize the hash to a new size */
 {
 int oldHashSize = hash->size;
 struct hashEl **oldTable = hash->table;
 
 if (powerOfTwoSize == 0)
     powerOfTwoSize = 12;
+if (powerOfTwoSize > hashMaxSize)
+    powerOfTwoSize =  hashMaxSize;
+if (hash->powerOfTwoSize == powerOfTwoSize)
+    return;
+
 assert(powerOfTwoSize <= hashMaxSize && powerOfTwoSize > 0);
 hash->powerOfTwoSize = powerOfTwoSize;
 hash->size = (1<<powerOfTwoSize);
 hash->mask = hash->size-1;
 
 AllocArray(hash->table, hash->size);
 
 int i;
 struct hashEl *hel, *next;
 for (i=0; i<oldHashSize; ++i)
     {
     for (hel = oldTable[i]; hel != NULL; hel = next)
 	{
 	next = hel->next;
 	int hashVal = hel->hashVal & hash->mask;