Fuzzing: Add QGuiApplication to gui fuzz targets
Change-Id: I3713701f63d9d8938fbb42ad1ae2f0c4ae813e94 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
68916fede4
commit
cd57dae62f
@ -1,4 +1,5 @@
|
|||||||
QT += gui
|
QT += gui
|
||||||
|
QTPLUGIN *= qminimal
|
||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
|
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
|
||||||
isEmpty(FUZZ_ENGINE) {
|
isEmpty(FUZZ_ENGINE) {
|
||||||
|
@ -34,8 +34,12 @@
|
|||||||
// to reduce noise and increase speed.
|
// to reduce noise and increase speed.
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const char *data, size_t size) {
|
extern "C" int LLVMFuzzerTestOneInput(const char *data, size_t size) {
|
||||||
static int c = 0;
|
static int argc = 3;
|
||||||
static QGuiApplication a(c, nullptr);
|
static char arg1[] = "fuzzer";
|
||||||
|
static char arg2[] = "-platform";
|
||||||
|
static char arg3[] = "minimal";
|
||||||
|
static char *argv[] = {arg1, arg2, arg3, nullptr};
|
||||||
|
static QGuiApplication qga(argc, argv);
|
||||||
QColorSpace cs = QColorSpace::fromIccProfile(QByteArray::fromRawData(data, size));
|
QColorSpace cs = QColorSpace::fromIccProfile(QByteArray::fromRawData(data, size));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,16 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QGuiApplication>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) {
|
extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) {
|
||||||
static int c = 0;
|
static int argc = 3;
|
||||||
static QApplication a(c, nullptr);
|
static char arg1[] = "fuzzer";
|
||||||
|
static char arg2[] = "-platform";
|
||||||
|
static char arg3[] = "minimal";
|
||||||
|
static char *argv[] = {arg1, arg2, arg3, nullptr};
|
||||||
|
static QGuiApplication qga(argc, argv);
|
||||||
QTextDocument().setHtml(QByteArray::fromRawData(Data, Size));
|
QTextDocument().setHtml(QByteArray::fromRawData(Data, Size));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
QT += widgets
|
QT += gui
|
||||||
|
QTPLUGIN *= qminimal
|
||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
|
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
|
||||||
isEmpty(FUZZ_ENGINE) {
|
isEmpty(FUZZ_ENGINE) {
|
||||||
|
@ -26,9 +26,16 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <QGuiApplication>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) {
|
extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) {
|
||||||
|
static int argc = 3;
|
||||||
|
static char arg1[] = "fuzzer";
|
||||||
|
static char arg2[] = "-platform";
|
||||||
|
static char arg3[] = "minimal";
|
||||||
|
static char *argv[] = {arg1, arg2, arg3, nullptr};
|
||||||
|
static QGuiApplication qga(argc, argv);
|
||||||
QTextDocument().setMarkdown(QByteArray::fromRawData(Data, Size));
|
QTextDocument().setMarkdown(QByteArray::fromRawData(Data, Size));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CONFIG += console
|
QT += gui
|
||||||
CONFIG -= app_bundle
|
QTPLUGIN *= qminimal
|
||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
|
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
|
||||||
isEmpty(FUZZ_ENGINE) {
|
isEmpty(FUZZ_ENGINE) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
QT += widgets
|
QT += gui
|
||||||
|
QTPLUGIN *= qminimal
|
||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
|
FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
|
||||||
isEmpty(FUZZ_ENGINE) {
|
isEmpty(FUZZ_ENGINE) {
|
||||||
|
@ -26,9 +26,16 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <QGuiApplication>
|
||||||
#include <QTextLayout>
|
#include <QTextLayout>
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) {
|
extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) {
|
||||||
|
static int argc = 3;
|
||||||
|
static char arg1[] = "fuzzer";
|
||||||
|
static char arg2[] = "-platform";
|
||||||
|
static char arg3[] = "minimal";
|
||||||
|
static char *argv[] = {arg1, arg2, arg3, nullptr};
|
||||||
|
static QGuiApplication qga(argc, argv);
|
||||||
QTextLayout tl(QByteArray::fromRawData(Data, Size));
|
QTextLayout tl(QByteArray::fromRawData(Data, Size));
|
||||||
tl.beginLayout();
|
tl.beginLayout();
|
||||||
tl.endLayout();
|
tl.endLayout();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user