Blame SOURCES/0017-QQmlJs-FixedPoolArray-fix-UB-precondition-violation-.patch

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