Merge lp:~brandontschaefer/miral/fix-unsigned-to-long-overflow into lp:miral
Status: | Rejected | ||||
---|---|---|---|---|---|
Rejected by: | Brandon Schaefer | ||||
Proposed branch: | lp:~brandontschaefer/miral/fix-unsigned-to-long-overflow | ||||
Merge into: | lp:miral | ||||
Diff against target: |
15 lines (+3/-2) 1 file modified
miral/window_info.cpp (+3/-2) |
||||
To merge this branch: | bzr merge lp:~brandontschaefer/miral/fix-unsigned-to-long-overflow | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Needs Fixing | |
Mir development team | Pending | ||
Review via email: mp+330778@code.launchpad.net |
Commit message
On armhf where sizeof(long) == sizeof(int) an overflow was happening when casting the unsigned::max() aspect to a long resulting in a -1. This allows for a div by 0 because the error check is positive due to the overflow:
Description of the change
On armhf where sizeof(long) == sizeof(int) an overflow was happening when casting the unsigned::max() aspect to a long resulting in a -1. This allows for a div by 0 because the error check is positive due to the overflow:
error = 640 * 0 - 420 * -1
if (error > 0)
// ends up in div by 0
The fix here sets the max value from unsigned::max() to int::max() since sizeof(long) >= sizeof(int). So an unsigned int can be casted into a long with out overflow.
Unmerged revisions
- 580. By Brandon Schaefer
-
* Set the min_aspect height and max_aspect width as an int::max().
Due to the aspects being cast into a long, we dont want to overflow
on a 32bit arch. sizeof(long) >= sizeof(int)
FAILED: Continuous integration, rev:580 /mir-jenkins. ubuntu. com/job/ miral-ci/ 75/ /mir-jenkins. ubuntu. com/job/ build-miral/ 121/console /mir-jenkins. ubuntu. com/job/ build-0- fetch/5239 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= artful/ 5227 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial/ 5227 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= zesty/5227 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- miral/arch= amd64,release= artful/ 125 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- miral/arch= amd64,release= artful/ 125/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- miral/arch= amd64,release= xenial/ 125 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- miral/arch= amd64,release= xenial/ 125/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- miral/arch= amd64,release= zesty/125/ console /mir-jenkins. ubuntu. com/job/ build-2- binpkg- miral/arch= i386,release= artful/ 125 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- miral/arch= i386,release= artful/ 125/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- miral/arch= i386,release= xenial/ 125 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- miral/arch= i386,release= xenial/ 125/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- miral/arch= i386,release= zesty/125/ console
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ miral-ci/ 75/rebuild
https:/