summaryrefslogtreecommitdiffstats
path: root/src/tools/uic/cpp/cppwriteincludes.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-12-12 22:08:07 +0100
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-12-18 18:34:19 +0200
commit4a727c376366e74520cf751de81052dae7b18782 (patch)
treeb13e5826af96c388b4ebd1b183c052faa80ff51b /src/tools/uic/cpp/cppwriteincludes.cpp
parentb2f09a2d72bb095705991b5b5128ed8097dfc0a9 (diff)
HPack: fix incorrect integer overflow check
This code never worked: For the comparison with max() - 32 to trigger, on 32-bit platforms (or Qt 5) signed interger overflow would have had to happen in the addition of the two sizes. The compiler can therefore remove the overflow check as dead code. On Qt 6 and 64-bit platforms, the signed integer addition would be very unlikely to overflow, but the following truncation to uint32 would yield the correct result only in a narrow 32-value window just below UINT_MAX, if even that. Fix by using the proper tool, qAddOverflow. Change-Id: I7599f2e75ff7f488077b0c60b81022591005661c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit ee5da1f2eaf8932aeca02ffea6e4c618585e29e3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit debeb8878da2dc706ead04b6072ecbe7e5313860) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 811b9eef6d08d929af8708adbf2a5effb0eb62d7) (cherry picked from commit f931facd077ce945f1e42eaa3bead208822d3e00) Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/tools/uic/cpp/cppwriteincludes.cpp')
0 files changed, 0 insertions, 0 deletions