]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
oss-fuzz: turn on the pointer-overflow check
authorEvgeny Vereshchagin <evvers@ya.ru>
Thu, 21 May 2020 06:20:01 +0000 (08:20 +0200)
committerEvgeny Vereshchagin <evvers@ya.ru>
Thu, 21 May 2020 06:52:18 +0000 (08:52 +0200)
It's off by default on OSS-Fuzz but it should be safe to turn it on
manually: https://github.com/google/oss-fuzz/issues/659#issuecomment-631897889

Just a follow-up to https://github.com/systemd/systemd/pull/15865.

tools/oss-fuzz.sh

index 79846f87879cfadc7be758e29fbf669ce0983cec..5b8690b687fe199d8e8dd121aab3f06129068f43 100755 (executable)
@@ -27,9 +27,15 @@ build=$WORK/build
 rm -rf $build
 mkdir -p $build
 
-fuzzflag="oss-fuzz=true"
 if [ -z "$FUZZING_ENGINE" ]; then
     fuzzflag="llvm-fuzz=true"
+else
+    fuzzflag="oss-fuzz=true"
+    if [[ "$SANITIZER" == undefined ]]; then
+        UBSAN_FLAGS="-fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow"
+        CFLAGS="$CFLAGS $UBSAN_FLAGS"
+        CXXFLAGS="$CXXFLAGS $UBSAN_FLAGS"
+    fi
 fi
 
 meson $build -D$fuzzflag -Db_lundef=false