Blame SOURCES/0017-QQmlJs-FixedPoolArray-fix-UB-precondition-violation-.patch
|
|
966857 |
From c6e595e7fbbe80c8db7ae33d8af05a4fd946a2f5 Mon Sep 17 00:00:00 2001
|
|
|
966857 |
From: Marc Mutz <marc.mutz@qt.io>
|
|
|
966857 |
Date: Tue, 21 Dec 2021 09:20:17 +0100
|
|
|
966857 |
Subject: [PATCH 17/20] QQmlJs::FixedPoolArray: fix UB (precondition violation)
|
|
|
966857 |
in allocate()
|
|
|
966857 |
|
|
|
966857 |
Says ubsan:
|
|
|
966857 |
|
|
|
966857 |
qqmljsfixedpoolarray_p.h:90:19: runtime error: null pointer passed as argument 2, which is declared to never be null
|
|
|
966857 |
|
|
|
966857 |
Fix, like in so many other places, by a size check.
|
|
|
966857 |
|
|
|
966857 |
Pick-to: 6.3 6.2 5.15
|
|
|
966857 |
Change-Id: I9181d6ecb467c2dc726978ce7f93b35a6bf2f944
|
|
|
966857 |
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
966857 |
(cherry picked from commit d74e931f3fc2587ac6d1e2930acbbe54ea5be2b5)
|
|
|
966857 |
---
|
|
|
966857 |
src/qml/common/qqmljsfixedpoolarray_p.h | 2 +-
|
|
|
966857 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
966857 |
|
|
|
966857 |
diff --git a/src/qml/common/qqmljsfixedpoolarray_p.h b/src/qml/common/qqmljsfixedpoolarray_p.h
|
|
|
966857 |
index b65b994d6c..15a8cd6878 100644
|
|
|
966857 |
--- a/src/qml/common/qqmljsfixedpoolarray_p.h
|
|
|
966857 |
+++ b/src/qml/common/qqmljsfixedpoolarray_p.h
|
|
|
966857 |
@@ -86,7 +86,7 @@ public:
|
|
|
966857 |
if (QTypeInfo<T>::isComplex) {
|
|
|
966857 |
for (int i = 0; i < count; ++i)
|
|
|
966857 |
new (data + i) T(vector.at(i));
|
|
|
966857 |
- } else {
|
|
|
966857 |
+ } else if (count) {
|
|
|
966857 |
memcpy(data, static_cast<const void*>(vector.constData()), count * sizeof(T));
|
|
|
966857 |
}
|
|
|
966857 |
}
|
|
|
966857 |
--
|
|
|
966857 |
2.35.1
|
|
|
966857 |
|