-
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
Consider adding findNextPositivePowerOfTwo which does bound checks #5601
Comments
Scottmitch
added a commit
to Scottmitch/netty
that referenced
this issue
Jul 29, 2016
Motivation: Some usages of findNextPositivePowerOfTwo assume that bounds checking is taken care of by this method. However bounds checking is not taken care of by findNextPositivePowerOfTwo and instead assert statements are used to imply the caller has checked the bounds. This can lead to unexpected non power of 2 return values if the caller is not careful and thus invalidate any logic which depends upon a power of 2. Modifications: - Add a safeFindNextPositivePowerOfTwo method which will do runtime bounds checks and always return a power of 2 Result: Fixes netty#5601
Scottmitch
added a commit
that referenced
this issue
Aug 2, 2016
Motivation: Some usages of findNextPositivePowerOfTwo assume that bounds checking is taken care of by this method. However bounds checking is not taken care of by findNextPositivePowerOfTwo and instead assert statements are used to imply the caller has checked the bounds. This can lead to unexpected non power of 2 return values if the caller is not careful and thus invalidate any logic which depends upon a power of 2. Modifications: - Add a safeFindNextPositivePowerOfTwo method which will do runtime bounds checks and always return a power of 2 Result: Fixes #5601
liuzhengyang
pushed a commit
to liuzhengyang/netty
that referenced
this issue
Sep 10, 2017
Motivation: Some usages of findNextPositivePowerOfTwo assume that bounds checking is taken care of by this method. However bounds checking is not taken care of by findNextPositivePowerOfTwo and instead assert statements are used to imply the caller has checked the bounds. This can lead to unexpected non power of 2 return values if the caller is not careful and thus invalidate any logic which depends upon a power of 2. Modifications: - Add a safeFindNextPositivePowerOfTwo method which will do runtime bounds checks and always return a power of 2 Result: Fixes netty#5601
pulllock
pushed a commit
to pulllock/netty
that referenced
this issue
Oct 19, 2023
Motivation: Some usages of findNextPositivePowerOfTwo assume that bounds checking is taken care of by this method. However bounds checking is not taken care of by findNextPositivePowerOfTwo and instead assert statements are used to imply the caller has checked the bounds. This can lead to unexpected non power of 2 return values if the caller is not careful and thus invalidate any logic which depends upon a power of 2. Modifications: - Add a safeFindNextPositivePowerOfTwo method which will do runtime bounds checks and always return a power of 2 Result: Fixes netty#5601
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See:
#5594 (comment)
The text was updated successfully, but these errors were encountered: