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

Cache configuration checks should consider negative values for NumCounters/MaxCost/BufferItems #378

Open
ankon opened this issue Apr 12, 2024 · 1 comment
Labels

Comments

@ankon
Copy link

ankon commented Apr 12, 2024

Found while reading through the code:

ristretto/cache.go

Lines 169 to 174 in c67e079

case config.NumCounters == 0:
return nil, errors.New("NumCounters can't be zero")
case config.MaxCost == 0:
return nil, errors.New("MaxCost can't be zero")
case config.BufferItems == 0:
return nil, errors.New("BufferItems can't be zero")

The checks are fine, but given that these are int64s they could be <0 which the checks won't catch unless I'm missing something.

Copy link

This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.

@github-actions github-actions bot added the Stale label Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant