Skip to content

Potential IndexOutOfBoundsException in RoundRobinHostHandler #431

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

Closed
wajda opened this issue Mar 28, 2022 · 0 comments · Fixed by #435
Closed

Potential IndexOutOfBoundsException in RoundRobinHostHandler #431

wajda opened this issue Mar 28, 2022 · 0 comments · Fixed by #435
Assignees

Comments

@wajda
Copy link
Contributor

wajda commented Mar 28, 2022

In highly loaded systems, an ever incrementing member variable current in the class RoundRobinHostHandler would numerically overflow within a quite realistic time horizon (months). It would cause the index variable to become negative resulting in an IndexOutOfBoundsException to be thrown.

final int index = (current++) % size;
Host host = hosts.getHostsList().get(index);

See: https://github.com/arangodb/arangodb-java-driver/blob/v6.16.1/src/main/java/com/arangodb/internal/net/RoundRobinHostHandler.java#L62:L63

Changing the current variable type to long would practically solve the issue.

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

Successfully merging a pull request may close this issue.

2 participants