with:
flags: unittests
+ ubuntu-20-04-cov-fuzz:
+ name: Ubuntu 20.04 (fuzz corpus coverage)
+ runs-on: ubuntu-latest
+ container: ubuntu:20.04
+ needs: [prepare-deps, prepare-cbindgen]
+ steps:
+ - name: Install dependencies
+ run: |
+ apt update
+ apt -y install \
+ libpcre3 \
+ libpcre3-dev \
+ build-essential \
+ autoconf \
+ automake \
+ llvm-10 \
+ clang-10 \
+ git \
+ jq \
+ libc++-dev \
+ libc++abi-dev \
+ libtool \
+ libpcap-dev \
+ libnet1-dev \
+ libyaml-0-2 \
+ libyaml-dev \
+ libcap-ng-dev \
+ libcap-ng0 \
+ libmagic-dev \
+ libnetfilter-queue-dev \
+ libnetfilter-queue1 \
+ libnfnetlink-dev \
+ libnfnetlink0 \
+ libhiredis-dev \
+ liblua5.1-dev \
+ libjansson-dev \
+ libevent-dev \
+ libevent-pthreads-2.1-7 \
+ libjansson-dev \
+ libpython2.7 \
+ make \
+ parallel \
+ python3-yaml \
+ rustc \
+ software-properties-common \
+ zlib1g \
+ zlib1g-dev \
+ exuberant-ctags \
+ unzip \
+ curl \
+ wget
+ - uses: actions/checkout@v2
+ - uses: actions/download-artifact@v2
+ with:
+ name: prep
+ path: prep
+ - run: tar xf prep/libhtp.tar.gz
+ - name: Setup cbindgen
+ run: |
+ mkdir -p $HOME/.cargo/bin
+ cp prep/cbindgen $HOME/.cargo/bin
+ chmod 755 $HOME/.cargo/bin/cbindgen
+ echo "$HOME/.cargo/bin" >> $GITHUB_PATH
+ - run: ./autogen.sh
+ - run: LIB_FUZZING_ENGINE="fail_to_onefile_driver" CC=clang-10 CXX=clang++-10 CFLAGS="-fprofile-arcs -ftest-coverage -g -fno-strict-aliasing -fsanitize=address -fno-omit-frame-pointer -fPIC -Wno-unused-parameter -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1" CXXFLAGS="-fprofile-arcs -ftest-coverage -g -fno-strict-aliasing -fsanitize=address -fno-omit-frame-pointer -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1 -stdlib=libc++" ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes ./configure --with-gnu-ld --enable-fuzztargets --disable-shared --enable-gccprotect
+ - run: make -j2
+ - run: ./qa/run-ossfuzz-corpus.sh
+ - name: Gcov
+ run: |
+ cd src
+ llvm-cov-10 gcov -p *.c
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v1
+ with:
+ flags: fuzzcorpus
+
ubuntu-20-04-ndebug:
name: Ubuntu 20.04 (-DNDEBUG)
runs-on: ubuntu-latest
--- /dev/null
+#/bin/sh
+ls src/fuzz_* | while read ftarget
+do
+ target=$(basename $ftarget)
+ echo "target $target"
+ #download public corpus
+ rm -f public.zip
+ wget --quiet "https://storage.googleapis.com/suricata-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/suricata_$target/public.zip"
+ rm -rf corpus_$target
+ unzip -q public.zip -d corpus_$target
+ #run target on corpus.
+ ./src/$target corpus_$target
+done
-#define _DEFAULT_SOURCE 1 // for DT_REG
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <dirent.h>
-#include <unistd.h>
-#include "autoconf.h"
+#include "suricata-common.h"
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);