summaryrefslogtreecommitdiffstats
path: root/tests/libfuzzer/corelib/text
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libfuzzer/corelib/text')
-rw-r--r--tests/libfuzzer/corelib/text/qregularexpression/optimize/CMakeLists.txt27
-rw-r--r--tests/libfuzzer/corelib/text/qregularexpression/optimize/main.cpp35
-rw-r--r--tests/libfuzzer/corelib/text/qregularexpression/optimize/optimize.pro8
3 files changed, 70 insertions, 0 deletions
diff --git a/tests/libfuzzer/corelib/text/qregularexpression/optimize/CMakeLists.txt b/tests/libfuzzer/corelib/text/qregularexpression/optimize/CMakeLists.txt
new file mode 100644
index 0000000000..a82e5fa340
--- /dev/null
+++ b/tests/libfuzzer/corelib/text/qregularexpression/optimize/CMakeLists.txt
@@ -0,0 +1,27 @@
+# Generated from optimize.pro.
+
+#####################################################################
+## optimize Binary:
+#####################################################################
+
+qt_add_executable(optimize
+ GUI
+ SOURCES
+ main.cpp
+)
+
+#### Keys ignored in scope 1:.:.:optimize.pro:<TRUE>:
+# FUZZ_ENGINE = "$$(LIB_FUZZING_ENGINE)"
+
+## Scopes:
+#####################################################################
+
+qt_extend_target(optimize CONDITION FUZZ_ENGINE_ISEMPTY
+ LINK_OPTIONS
+ "-fsanitize=fuzzer"
+)
+
+qt_extend_target(optimize CONDITION NOT FUZZ_ENGINE_ISEMPTY
+ PUBLIC_LIBRARIES
+ $ENV{LIB_FUZZING_ENGINE}
+)
diff --git a/tests/libfuzzer/corelib/text/qregularexpression/optimize/main.cpp b/tests/libfuzzer/corelib/text/qregularexpression/optimize/main.cpp
new file mode 100644
index 0000000000..30a714c250
--- /dev/null
+++ b/tests/libfuzzer/corelib/text/qregularexpression/optimize/main.cpp
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QRegularExpression>
+
+extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) {
+ QRegularExpression qre(QByteArray::fromRawData(Data, Size));
+ qre.optimize();
+ return 0;
+}
diff --git a/tests/libfuzzer/corelib/text/qregularexpression/optimize/optimize.pro b/tests/libfuzzer/corelib/text/qregularexpression/optimize/optimize.pro
new file mode 100644
index 0000000000..196aca42eb
--- /dev/null
+++ b/tests/libfuzzer/corelib/text/qregularexpression/optimize/optimize.pro
@@ -0,0 +1,8 @@
+QT -= gui
+SOURCES += main.cpp
+FUZZ_ENGINE = $$(LIB_FUZZING_ENGINE)
+isEmpty(FUZZ_ENGINE) {
+ QMAKE_LFLAGS += -fsanitize=fuzzer
+} else {
+ LIBS += $$FUZZ_ENGINE
+}