summaryrefslogtreecommitdiffstats
path: root/examples/widgets/doc/src
diff options
context:
space:
mode:
authorMarc Mutz <[email protected]>2024-01-30 11:15:13 +0100
committerMarc Mutz <[email protected]>2024-02-01 18:42:13 +0100
commit78f8dfc5427457783ceef7d85885cddbec035ebe (patch)
tree7694617760a483108bb954e390ba306994d6b085 /examples/widgets/doc/src
parent5ba0982b2879a1a4c13bf97467b8e5ad296e57a2 (diff)
QBitArray: avoid overflow in storage-to-size 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 (d.size() * 8 - *d.data()) storage-to-logical-size calculation by using unsigned arithmetic. Use the opportunity to Extract Method adjust_head_and_tail(), centralizing the bit fiddling. Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I485eafdf3ce2087a81c683672ff98a43f97c9968 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Thiago Macieira <[email protected]>
Diffstat (limited to 'examples/widgets/doc/src')
0 files changed, 0 insertions, 0 deletions