aboutsummaryrefslogtreecommitdiff
path: root/projects/qt
diff options
context:
space:
mode:
authorRobert Löhning <robert.loehning@qt.io>2020-06-29 21:43:17 +0200
committerGitHub <noreply@github.com>2020-06-29 12:43:17 -0700
commit7da55877b64c695cd5840ef2f101c17755c7009c (patch)
tree62942ed6481ee378b03653b0cd78601a69f074a2 /projects/qt
parentd15dc2a88f9a3fb3fe919422fd60d606182691e8 (diff)
downloadoss-fuzz-7da55877b64c695cd5840ef2f101c17755c7009c.tar.gz
[qt] Move build.sh to own repository (#4042)
Diffstat (limited to 'projects/qt')
-rw-r--r--projects/qt/Dockerfile2
-rwxr-xr-xprojects/qt/build.sh96
2 files changed, 1 insertions, 97 deletions
diff --git a/projects/qt/Dockerfile b/projects/qt/Dockerfile
index 89732b826..0629b2a53 100644
--- a/projects/qt/Dockerfile
+++ b/projects/qt/Dockerfile
@@ -23,5 +23,5 @@ RUN git submodule update --init --depth 1 qtbase
RUN git submodule update --init --depth 1 qtsvg
WORKDIR $SRC
RUN git clone --depth 1 git://code.qt.io/qt/qtqa.git
+RUN cp qtqa/fuzzing/oss-fuzz/build.sh $SRC/
RUN git clone --depth 1 https://github.com/google/AFL.git
-COPY build.sh $SRC/
diff --git a/projects/qt/build.sh b/projects/qt/build.sh
deleted file mode 100755
index 994cba957..000000000
--- a/projects/qt/build.sh
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/bin/bash -eu
-# Copyright 2019 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-################################################################################
-
-# add the flags to Qt build, gratefully borrowed from karchive
-cd $SRC/qt/qtbase/mkspecs
-sed -i -e "s/QMAKE_CXXFLAGS += -stdlib=libc++/QMAKE_CXXFLAGS += -stdlib=libc++ $CXXFLAGS\nQMAKE_CFLAGS += $CFLAGS/g" linux-clang-libc++/qmake.conf
-sed -i -e "s/QMAKE_LFLAGS += -stdlib=libc++/QMAKE_LFLAGS += -stdlib=libc++ -lpthread $CXXFLAGS/g" linux-clang-libc++/qmake.conf
-
-# set optimization to O1
-sed -i -e "s/QMAKE_CFLAGS_OPTIMIZE = -O2/QMAKE_CFLAGS_OPTIMIZE = -O1/g" common/gcc-base.conf
-sed -i -e "s/QMAKE_CFLAGS_OPTIMIZE_FULL = -O3/QMAKE_CFLAGS_OPTIMIZE_FULL = -O1/g" common/gcc-base.conf
-
-# remove -fno-rtti which conflicts with -fsanitize=vptr when building with sanitizer undefined
-sed -i -e "s/QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti/QMAKE_CXXFLAGS_RTTI_OFF = /g" common/gcc-base.conf
-
-# build project
-cd $WORK
-MAKEFLAGS=-j$(nproc) $SRC/qt/configure -qt-libmd4c -platform linux-clang-libc++ -static -opensource -confirm-license -no-opengl -nomake tests -nomake examples -prefix $PWD/qtbase -D QT_NO_DEPRECATED_WARNINGS
-make -j$(nproc) > /dev/null
-
-# prepare corpus files
-zip -j $WORK/cbor $SRC/qtqa/fuzzing/testcases/cbor/*
-zip -j $WORK/html $SRC/qtqa/fuzzing/testcases/html/*
-zip -j $WORK/images $SRC/qtqa/fuzzing/testcases/svg/* $SRC/AFL/testcases/images/*/*
-zip -j $WORK/markdown $SRC/qtqa/fuzzing/testcases/markdown/*
-zip -j $WORK/ssl.pem.zip $SRC/qtqa/fuzzing/testcases/ssl.pem/*
-zip -j $WORK/svg $SRC/qtqa/fuzzing/testcases/svg/*
-zip -j $WORK/text $SRC/qtqa/fuzzing/testcases/text/* $SRC/AFL/testcases/others/text/*
-zip -j $WORK/xml $SRC/qtqa/fuzzing/testcases/xml/* $SRC/AFL/testcases/others/xml/*
-
-# build fuzzers
-
-build_fuzzer() {
- local nameScheme=$1
- local module=$2
- local proFilePath=$3
- local format=${4-""}
- local dictionary=${5-""}
- local proFileName=${proFilePath##*/}
- local exeName=${proFileName%%.*}
- local proFileDir=${proFilePath%/*}
- local targetName="$module"_${proFileDir//\//_}
- mkdir build_fuzzer
- cd build_fuzzer
- $WORK/qtbase/bin/qmake $SRC/qt/$module/tests/libfuzzer/$proFilePath
- make -j$(nproc)
-
- # use old names of fuzzers, so open issues don't change state accidentally
- local lowercaseExeName=$exeName
- if [ "$exeName" == "setmarkdown" ]; then
- exeName=setMarkdown
- fi
- if [ "$lowercaseExeName" != "$exeName" ]; then
- mv $lowercaseExeName $exeName
- fi
- if [ "$nameScheme" == "old" ]; then
- targetName="$exeName"
- fi
-
- mv $exeName $OUT/$targetName
- if [ -n "$format" ]; then
- cp $WORK/$format.zip $OUT/"$targetName"_seed_corpus.zip
- fi
- if [ -n "$dictionary" ]; then
- cp $dictionary $OUT/$targetName.dict
- fi
- cd ..
- rm -r build_fuzzer
-}
-
-build_fuzzer "new" "qtbase" "corelib/serialization/qcborstreamreader/next/next.pro" "cbor"
-build_fuzzer "new" "qtbase" "corelib/serialization/qcborvalue/fromcbor/fromcbor.pro" "cbor"
-build_fuzzer "new" "qtbase" "corelib/serialization/qtextstream/extractionoperator-float/extractionoperator-float.pro" "text"
-build_fuzzer "old" "qtbase" "corelib/serialization/qxmlstream/qxmlstreamreader/readnext/readnext.pro" "xml" "$SRC/AFL/dictionaries/xml.dict"
-build_fuzzer "new" "qtbase" "corelib/text/qregularexpression/optimize/optimize.pro" "" "$SRC/AFL/dictionaries/regexp.dict"
-build_fuzzer "new" "qtbase" "gui/image/qimage/loadfromdata/loadfromdata.pro" "images"
-build_fuzzer "new" "qtbase" "gui/painting/qcolorspace/fromiccprofile/fromiccprofile.pro"
-build_fuzzer "new" "qtbase" "gui/text/qtextdocument/sethtml/sethtml.pro" "html" "$SRC/AFL/dictionaries/html_tags.dict"
-build_fuzzer "old" "qtbase" "gui/text/qtextdocument/setmarkdown/setmarkdown.pro" "markdown"
-build_fuzzer "new" "qtbase" "gui/text/qtextlayout/beginlayout/beginlayout.pro" "text"
-build_fuzzer "new" "qtbase" "network/ssl/qsslcertificate/qsslcertificate/pem/pem.pro" "ssl.pem"
-build_fuzzer "new" "qtsvg" "svg/qsvgrenderer/render/render.pro" "svg"