From ec77f93b389d0a69af54f278a8bf7c4919fd696c Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Fri, 17 Jan 2014 13:28:37 +0100 Subject: Fix crash when constructing a QVector with an empty initializer list. Data::allocate(0) returns a pointer to read-only memory, updating d->size will segfault. The safety check for this exists in all other QVector ctors already. Change-Id: Ida0fe4182de56ee62c7f91e8652cfafbfd7b8410 Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qvector/tst_qvector.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index 53caec4a64..59956e33cf 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -2042,6 +2042,9 @@ void tst_QVector::initializeList() QVector> v3; v3 << v1 << (QVector() << val4) << QVector() << v1; QCOMPARE(v3, v2); + + QVector v4({}); + QCOMPARE(v4.size(), 0); #endif } -- cgit v1.2.3