QByteArray: Make gcc 12 happy
It somehow concludes that asize may be negative and would then cast to
an obscenely large size_t. This produces the following warning:
.../qbytearray.cpp: In member function ‘replace.constprop.isra’:
.../qbytearray.cpp:2579:23: warning: ‘memcpy’ specified bound between 9223372036854775808 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
2579 | memcpy(d + to, a, asize);
| ^
Check for asize > 0 rather than asize != 0.
Pick-to: 6.5
Change-Id: I63bccb1bf3ff45d539af4efe6843d2c648d7cb86
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 177cd123d29f818413db4bb7a9d92b8485c95947)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b9169c12105414e58b7a0244a867d6e8fa96f572)
bb10
parent
e9146b64f2
commit
80f5aeeb85
|
|
@ -2551,7 +2551,7 @@ QByteArray &QByteArray::replace(QByteArrayView before, QByteArrayView after)
|
|||
} else {
|
||||
to = index;
|
||||
}
|
||||
if (asize) {
|
||||
if (asize > 0) {
|
||||
memcpy(d + to, a, asize);
|
||||
to += asize;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue