summaryrefslogtreecommitdiff
path: root/vcl/workben/jpgfuzzer.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-12-30 15:30:20 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-01-02 20:36:13 +0000
commit85e8507d19195387784ba6af42d91609b129e00d (patch)
tree7becdfed97aa7c8abe37d4194046ba9cf2532b4f /vcl/workben/jpgfuzzer.cxx
parentf6ff601b820749898a045e115cc0dc460e996104 (diff)
add a jpg fuzzer
reshuffle things to share common core Change-Id: I50aa0e2ddeefaa4b2d0592b1118defd28b7347db
Diffstat (limited to 'vcl/workben/jpgfuzzer.cxx')
-rw-r--r--vcl/workben/jpgfuzzer.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/vcl/workben/jpgfuzzer.cxx b/vcl/workben/jpgfuzzer.cxx
new file mode 100644
index 000000000000..429401afe9bf
--- /dev/null
+++ b/vcl/workben/jpgfuzzer.cxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <tools/stream.hxx>
+#include <../source/filter/jpeg/jpeg.hxx>
+#include "commonfuzzer.hxx"
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
+ SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
+ Graphic aGraphic;
+ (void)ImportJPEG(aStream, aGraphic, nullptr, GraphicFilterImportFlags::NONE);
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */