qt6-bb10/tests/auto/corelib
Marc Mutz c6aa399d06 QBitArray: avoid overflow in size-to-storage calculations
Unlike other containers, a QBitArray's size() is not limited by
storage, but, esp. on 32-bit platforms, its size_type: A INT_MAX
size() QBitArray only requires 256MiB of storage.

So we can't rely on "won't happen in practice" here and need to avoid
the potential UB (signed overflow) in the (size + 7) / 8
logical-to-storage-size calculation by using unsigned arithmetic.

Use the opportunity to Extract Methods storage_size() and
allocation_size(), which differ by one (d[[0] contains the size() mod
8), making it clear what's what.

[ChangeLog][QtCore][QBitArray] Fixed a bug with QBitArrays whose
size() came within 7 of the size_type's maximum.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: I5d94bae9c9c210ba1e36f8cf03609125c81bd15d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-01-30 22:28:19 +01:00
..
animation Tests: remove blacklisted CIs no longer available 2023-12-06 22:07:44 +01:00
global Un-blacklist QMessageLogger backtrace tests for b2qt 64bit 2024-01-22 17:51:56 +01:00
io Add VxWorks to skip condition when utimensat function is required 2024-01-24 19:41:08 +01:00
ipc Skip tst_QSharedMemory::useTooMuchMemory 2023-12-22 17:01:01 +02:00
itemmodels Introduce macros to simplify testing comparison 2024-01-19 12:58:57 +00:00
kernel QJniArray: make reverse-iterable 2024-01-29 16:06:47 +01:00
mimetypes QMimeDataBase: Remove dead code 2024-01-16 22:56:44 +01:00
platform Android: Add a context delegate for embedding QML to native Android 2024-01-21 15:46:30 +02:00
plugin Resurrect tests/auto/corelib/plugin/qpluginloader/machtest 2024-01-10 00:44:34 +01:00
serialization QDataStream: add a new SizeLimitExceeded status code 2024-01-26 15:10:16 +01:00
text Add expect-fail test-cases for und_US, und_GB to tst_QLocale::ctor() 2024-01-30 14:48:17 +01:00
thread QFuture: Don't use QFutureCallOutInterface for continuations 2023-12-13 21:54:00 +01:00
time Introduce macros to simplify testing comparison 2024-01-19 12:58:57 +00:00
tools QBitArray: avoid overflow in size-to-storage calculations 2024-01-30 22:28:19 +01:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00