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

Overflows under certain conditions due to wrong variable type. #1

Closed
Ryu0118 opened this issue Jun 25, 2022 · 0 comments
Closed

Overflows under certain conditions due to wrong variable type. #1

Ryu0118 opened this issue Jun 25, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Ryu0118
Copy link
Owner

Ryu0118 commented Jun 25, 2022

A bug that causes overflow occurs.
Since the type of the variable is usize, it overflows when a negative value is entered.
It happens at line 146 of src/main.rs.

let require_width = index * 2;
let current_width = month_line.len();
let require_space = require_width - current_width;

Converting from usize to i64 solves this problem.

@Ryu0118 Ryu0118 added the bug Something isn't working label Jun 25, 2022
@Ryu0118 Ryu0118 closed this as completed Jun 25, 2022
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