Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrentHashMap.<someCollection>.toArray() can throw ArrayIndexOutOfBoundsexception #381

Open
jentfoo opened this issue Dec 15, 2014 · 0 comments
Assignees
Labels

Comments

@jentfoo
Copy link
Contributor

jentfoo commented Dec 15, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants