diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-11-01 21:43:48 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-11-08 15:20:01 +0000 |
commit | 9d90c0edac91b35ec96646fd3e6cdd339639ca79 (patch) | |
tree | ef5d3b2df364e610e0248053046a567c3978ee3d /src/xml | |
parent | f80ed83cd92deb015b78c39f4c634c046ef75b1c (diff) |
QImage: merge the size calculations with proper (non-UB) checks
This check, which was only done once, was wrong:
const int bytes_per_line = ((width * depth + 31) >> 5) << 2;
// sanity check for potential overflows
if (std::numeric_limits<int>::max()/depth < width
If width*height overflows, then it's already UB and checking afterwards
with a division is pointless and slow.
The other instances weren't properly guarding against overflows.
Change-Id: I343f2beed55440a7ac0bfffd1563350d4cfa639c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/xml')
0 files changed, 0 insertions, 0 deletions