diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-22 16:57:13 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-23 13:26:57 +0000 |
commit | b9bc6c31a0987143cfedee7041d542b26a726966 (patch) | |
tree | f6237f20720f26c9c86394f1a33f6a5401ff5710 /examples/widgets/tools | |
parent | c416a7f25770563a265cc86e779f2e54c01a85a0 (diff) |
Fix potential 16-bit integer overflow
When multiplying a float in [0;1[ with (1<<16), with rounding, it might
end up being rounded to 65536 even if the input was under 1. This patch
uses a floor operation to make sure the value can be in a ushort, and
cleans up the surrounding code so it is clearer what it does.
Task-number: QTBUG-68360
Change-Id: I2d566586765db3d68e8e7e5fb2fd1df20dabd922
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'examples/widgets/tools')
0 files changed, 0 insertions, 0 deletions