mirror of https://github.com/qt/qtbase.git
Add a QCoreApplication to QSslCertificate fuzz test
Through the use of QApplicationStatic we need to create an *Application before instantiating the TLS backends. Change-Id: I1e72ca349f7fed19cec88328fad446cfbcb4f06c Reviewed-by: Robert Löhning <robert.loehning@qt.io>
This commit is contained in:
parent
7e80b36f44
commit
9bcf17de50
|
@ -1,6 +1,7 @@
|
|||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QSslCertificate>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) {
|
||||
|
@ -8,6 +9,10 @@ extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) {
|
|||
static char quiet[] = "QT_LOGGING_RULES=qt.*=false";
|
||||
static int pe = putenv(quiet);
|
||||
Q_UNUSED(pe);
|
||||
static int argc = 1;
|
||||
static char arg1[] = "fuzzer";
|
||||
static char *argv[] = { arg1, nullptr };
|
||||
static QCoreApplication app(argc, argv);
|
||||
QSslCertificate ssl(QByteArray::fromRawData(Data, Size), QSsl::Pem);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue