avian
avian copied to clipboard
ConcurrentHashMap.<someCollection>.toArray() can throw ArrayIndexOutOfBoundsexception
I noticed this while looking for another issue. If you do ConcurrentHashMap.entrySet/values/keySet, and then try to call .toArray (weather an array is passed in or not). If the map structure grows after the .size() check in Data.toArray, the iterator will end up getting an extra element than the array that was allocated for it. Thus the out of bounds exception will be thrown when we try to store an element in the array we have not allocated for.