Skip to content

Potential IndexOutOfBoundsException in RoundRobinHostHandler #431

Closed
@wajda

Description

@wajda

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions