diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2023-06-27 13:02:45 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2023-06-27 21:33:17 +0200 |
| commit | 8a39f7655f4cfbc35c1886b49e2f3a9ada263e39 (patch) | |
| tree | 561e2363d4c0174e2fb543f6dd2bb671a06e503a /src/quicktestutils/quick/visualtestutils.cpp | |
| parent | 2b649a7fa0ea192a96ce15326a78b39c0ad05b2b (diff) | |
QQmlJs::MemoryPool: fix potential UB (pointer overflow)
A check like (p1 + s op p2) is dangerous, because p1 + s may overflow,
and that would be UB, so the compiler can assume it doesn't happen and
break the check.
Reformulate the expression by subtracting p1 from both sides. Cast the
ptrdiff_t to size_t to avoid -Wsign-compare. This is safe because _end
is always ≥ _ptr.
As a drive-by, remove extra parentheses.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: If240d685fe48196ab5ceb7ff39736b73c8997e30
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/quicktestutils/quick/visualtestutils.cpp')
0 files changed, 0 insertions, 0 deletions
