diff options
author | Robert Loehning <robert.loehning@qt.io> | 2019-02-25 18:27:11 +0100 |
---|---|---|
committer | Robert Loehning <robert.loehning@qt.io> | 2019-04-30 17:18:14 +0000 |
commit | 899ccaa307e49af0c3f2f2ea785301e3e6eaff14 (patch) | |
tree | 2ab5b45a6472ba00d8bd8d8d315a0df0a76c0863 /tests/libfuzzer/svg/qsvgrenderer | |
parent | 34be23d36bad94806bbb6d2cc9ffb3467f6734e3 (diff) | |
download | qtsvg-899ccaa307e49af0c3f2f2ea785301e3e6eaff14.tar.gz |
Add libfuzzer test for QSvgRenderer::render()
Task-number: QTBUG-74104
Change-Id: I4ce6a9e4ddc51c904af4a9bf4fb14e52fd8a23c8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/libfuzzer/svg/qsvgrenderer')
-rw-r--r-- | tests/libfuzzer/svg/qsvgrenderer/render/main.cpp | 42 | ||||
-rw-r--r-- | tests/libfuzzer/svg/qsvgrenderer/render/render.pro | 3 |
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/libfuzzer/svg/qsvgrenderer/render/main.cpp b/tests/libfuzzer/svg/qsvgrenderer/render/main.cpp new file mode 100644 index 0000000..0197115 --- /dev/null +++ b/tests/libfuzzer/svg/qsvgrenderer/render/main.cpp @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2019 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 <QApplication> +#include <QImage> +#include <QPainter> +#include <QSvgRenderer> + +extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) { + static int c = 0; + static QApplication a(c, nullptr); + static QImage image(377, 233, QImage::Format_RGB32); + static QPainter painter(&image); + QSvgRenderer renderer(QByteArray(Data, Size)); + renderer.render(&painter); + return 0; +} diff --git a/tests/libfuzzer/svg/qsvgrenderer/render/render.pro b/tests/libfuzzer/svg/qsvgrenderer/render/render.pro new file mode 100644 index 0000000..be94755 --- /dev/null +++ b/tests/libfuzzer/svg/qsvgrenderer/render/render.pro @@ -0,0 +1,3 @@ +QT += svg +SOURCES += main.cpp +LIBS += -fsanitize=fuzzer |