Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Issue 2585263003: Avoid overflow when checking if a transform is integer translation. (Closed)

Created:
4 years ago by danakj
Modified:
4 years ago
Reviewers:
ajuma
CC:
chromium-reviews, enne (OOO)
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Avoid overflow when checking if a transform is integer translation. If the floating point number in the matrix can not be represented as an integer then we should return false so that the calling code does not try to cast it as one. For large enough integers this may return an incorrect result still, as it may return true if the floating point representation has a fractional part if that floating point representation also is used for an integer converted to float. But at that point we can not tell which would be closer to the original intent - using the integer-casted number or the floating point one, so we leave the result as before. R=ajuma@chromium.org BUG=675435 Committed: https://crrev.com/602038a90b8b56b4a96a619962f41f03d42b3c46 Cr-Commit-Position: refs/heads/master@{#439584}

Patch Set 1 #

Total comments: 2

Patch Set 2 : integer-transform #

Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -5 lines) Patch
M ui/gfx/transform.h View 1 1 chunk +4 lines, -2 lines 0 comments Download
M ui/gfx/transform.cc View 1 chunk +6 lines, -3 lines 0 comments Download
M ui/gfx/transform_unittest.cc View 1 chunk +10 lines, -0 lines 0 comments Download

Messages

Total messages: 15 (7 generated)
danakj
4 years ago (2016-12-19 16:45:40 UTC) #1
danakj
These tests would pass before too normally, but they would fail on UBSAN bots.
4 years ago (2016-12-19 16:46:27 UTC) #4
ajuma
lgtm https://codereview.chromium.org/2585263003/diff/1/ui/gfx/transform.cc File ui/gfx/transform.cc (right): https://codereview.chromium.org/2585263003/diff/1/ui/gfx/transform.cc#newcode255 ui/gfx/transform.cc:255: static_cast<int>(t[2]) == t[2]; Maybe update the comment in ...
4 years ago (2016-12-19 18:01:25 UTC) #5
danakj
https://codereview.chromium.org/2585263003/diff/1/ui/gfx/transform.cc File ui/gfx/transform.cc (right): https://codereview.chromium.org/2585263003/diff/1/ui/gfx/transform.cc#newcode255 ui/gfx/transform.cc:255: static_cast<int>(t[2]) == t[2]; On 2016/12/19 18:01:25, ajuma wrote: > ...
4 years ago (2016-12-19 18:06:22 UTC) #6
danakj
Done
4 years ago (2016-12-19 18:24:36 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2585263003/20001
4 years ago (2016-12-19 18:25:19 UTC) #10
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years ago (2016-12-19 22:07:20 UTC) #13
commit-bot: I haz the power
4 years ago (2016-12-19 22:10:09 UTC) #15
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/602038a90b8b56b4a96a619962f41f03d42b3c46
Cr-Commit-Position: refs/heads/master@{#439584}

Powered by Google App Engine
This is Rietveld 408576698