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

Severe undefined behavior on Windows(MSYS2) #22

Closed
Cryptiiiic opened this issue May 31, 2024 · 1 comment
Closed

Severe undefined behavior on Windows(MSYS2) #22

Cryptiiiic opened this issue May 31, 2024 · 1 comment

Comments

@Cryptiiiic
Copy link

When you define your own bool implementation, the msys2 compiler(s) define the bool enum as 4 bytes!

typedef enum{
false = 0,
true = 1
}bool;

This causes severe undefined behavior. When doing boolean comparision in eg: tsschecker is_ota param for one of the functions, it returns true because its reading random 2 extra bytes instead of just the boolean value. Those extra bytes can be any memory, one or zero. This is really bad.

Proposed fix:
Why don't you just include stdbool instead?

#include <stdbool.h>
@tihmstar
Copy link
Owner

I don't quite understand in which cases this would break, but i agree that including #include <stdbool.h> is a cleaner solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants