-
Notifications
You must be signed in to change notification settings - Fork 99
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
Undefined behavior #211
Comments
More, open window list: src/wmwinlist.cc:467:20: runtime error: unsigned integer overflow: 102 - 165 cannot be represented in type 'unsigned int' |
The messages point out that it is not about math but about types. |
Dealing with signedness is not a problem. The problem is that some of those variables are unsigned because they used directly or indirectly in X11 API calls. And there it's hard to tell whether there are reserved ranges or special values, unless you know the APIs by heart. In some cases it might be possible to go with int64_t but it's IMHO ultima ratio and not applicable everywhere and still needs to be considered properly. |
I changed a lot of heights and widths to unsigned to expose this very issue. Many calculation seem to be ignorant of the fact that their results cannot be less than or equal to zero. |
It caused a number of bugs, some of which are still not solved... |
Should be fixed by somebody who is sober enough and has time to deal with math...
Repro steps: build with -fsanitize=integer , run, move windows around, let the tool tips appear on the edges of the screen, open menus on the edges.
Bonus points: I think I have seen one of them with icewmbg too.
src/ypopup.cc:156:27: runtime error: unsigned integer overflow: 333 + 4294967295 cannot be represented in type 'unsigned int'
src/ypopup.cc:156:15: runtime error: unsigned integer overflow: 242 - 332 cannot be represented in type 'unsigned int'
src/ypopup.cc:168:22: runtime error: unsigned integer overflow: 4294967206 + 333 cannot be represented in type 'unsigned int'
src/ypopup.cc:183:16: runtime error: unsigned integer overflow: 4294967206 + 333 cannot be represented in type 'unsigned int'
src/ypopup.cc:147:26: runtime error: unsigned integer overflow: 183 + 4294967295 cannot be represented in type 'unsigned int'
src/ypopup.cc:147:15: runtime error: unsigned integer overflow: 408 - 411 cannot be represented in type 'unsigned int'
src/ypopup.cc:161:22: runtime error: unsigned integer overflow: 4294967293 + 233 cannot be represented in type 'unsigned int'
src/ypopup.cc:164:15: runtime error: unsigned integer overflow: 4294967293 + 411 cannot be represented in type 'unsigned int'
The text was updated successfully, but these errors were encountered: