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

Danger of integer overflow #65

Open
S1yGus opened this issue Mar 26, 2024 · 0 comments
Open

Danger of integer overflow #65

S1yGus opened this issue Mar 26, 2024 · 0 comments
Assignees
Labels
invalid This doesn't seem right

Comments

@S1yGus
Copy link
Owner

S1yGus commented Mar 26, 2024

FORCEINLINE Position operator+(const Input& input) const { return {x + input.x, y + input.y}; }

Potentially dangerous operator overload that may cause integer overflow (uint + int). Specifically, in the current implementation of the game, there should be no issues as the Input should not exceed the value range of -1 to 1, and the Position of possible cells for movement starts from x = 1, y = 1 due to the walls on the grid. However, it is advisable to refactor to eliminate the potential problem.

@S1yGus S1yGus added the invalid This doesn't seem right label Mar 26, 2024
@S1yGus S1yGus self-assigned this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
Status: Todo
Development

No branches or pull requests

1 participant