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

Binary operations can move values outside of valid bounds #509

Open
mhostetter opened this issue Sep 30, 2023 · 2 comments
Open

Binary operations can move values outside of valid bounds #509

mhostetter opened this issue Sep 30, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mhostetter
Copy link
Owner

import numpy as np

import galois

x = galois.GF2([1, 0, 1])
print(x)

x = np.left_shift(x, 1)
print(x)
$ python3 test_left_shift.py 
[1 0 1]
[2 0 2]  # Should error
@mhostetter mhostetter added the bug Something isn't working label Sep 30, 2023
@mhostetter
Copy link
Owner Author

import numpy as np

import galois

x = galois.GF2([1, 0, 1])
print(x)

x = np.bitwise_or(x, 0b10)
print(x)
$ python3 test_bitwise_or.py
[1 0 1]
[3 2 3]  # Should error

@mhostetter
Copy link
Owner Author

Maybe use _view() instead of _view_without_verification() for operations that could expand the bit depth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant