diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2022-12-23 15:52:22 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-01-05 20:13:58 +0000 |
commit | 98c4c4c2129790786193ab02a83cdce9b43a4e35 (patch) | |
tree | 39408b6ea1de67a62cd8ec34558dbf307760653d | |
parent | 5aca4e09ec22d4219df168207e08ce5b104a51cb (diff) |
Fix potential corruption with image format conversion on arm neon
For tiny scanline lengths, even the initial offset to align on 16
bytes may overflow.
Fixes: QTBUG-109477
Change-Id: I198c6fa5a2551a951893515f905bb7cc35479608
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 7eccd7ac1c98e0c15c0b4a13d036a5ef46896d8a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/gui/image/qimage_neon.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/image/qimage_neon.cpp b/src/gui/image/qimage_neon.cpp index 17cd755e68..2b0b5ad705 100644 --- a/src/gui/image/qimage_neon.cpp +++ b/src/gui/image/qimage_neon.cpp @@ -54,7 +54,7 @@ Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_neon(quint32 *dst, cons // align dst on 128 bits const int offsetToAlignOn16Bytes = (reinterpret_cast<quintptr>(dst) >> 2) & 0x3; - for (int i = 0; i < offsetToAlignOn16Bytes; ++i) { + for (int i = 0; i < qMin(len, offsetToAlignOn16Bytes); ++i) { *dst++ = qRgb(src[0], src[1], src[2]); src += 3; } |