Sophie

Sophie

distrib > Mageia > cauldron > x86_64 > media > core-release-src > by-pkgid > 4c532bfb9916518564da5ba2805999f5 > files > 68

qtbase5-5.15.12-3.mga10.src.rpm

From ff8d029c6999502c0db16321d589674230fe52ae Mon Sep 17 00:00:00 2001
From: Eirik Aavitsland <eirik.aavitsland@qt.io>
Date: Fri, 23 Dec 2022 15:52:22 +0100
Subject: [PATCH 069/147] 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
Pick-to: 6.5 6.4 6.2 5.15
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)
---
 src/gui/image/qimage_neon.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gui/image/qimage_neon.cpp b/src/gui/image/qimage_neon.cpp
index 9dbcb11db5..c17f76f2b0 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;
     }
-- 
2.40.1