mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2026-01-26 21:41:34 +03:00
test with fuzzing harnesses
This commit is contained in:
committed by
Daniel Garcia Moreno
parent
51035e7068
commit
24a0ceca5c
@@ -365,3 +365,8 @@ downstream-xmlstarlet:
|
||||
needs: [install]
|
||||
script:
|
||||
- sh .gitlab-ci/downstream-xmlstarlet.sh
|
||||
|
||||
downstream-fuzzingharness:
|
||||
image: gcr.io/oss-fuzz-base/base-builder@sha256:0241b5bf8a95a788807fd6632d544a0bae7289bd17f04b766dec79db7acab5f5
|
||||
script:
|
||||
- .gitlab-ci/downstream-harnessagent.sh
|
||||
|
||||
@@ -2,15 +2,45 @@
|
||||
|
||||
cd /src
|
||||
|
||||
git clone https://github.com/zhangutah/oss-fuzz-harnessagent
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export FUZZING_LANGUAGE=c
|
||||
|
||||
git clone https://github.com/zhangutah/oss-fuzz-harnessagent -b filter_libxml2 /src/oss-fuzz
|
||||
|
||||
git clone --depth=1 https://github.com/gnome/libxml2 && \
|
||||
cd libxml2 && \
|
||||
cd libxml2 && apt-get update && \
|
||||
apt-get install -y --no-install-recommends make autoconf libtool pkg-config zlib1g-dev liblzma-dev && \
|
||||
curl -LO http://mirrors.kernel.org/ubuntu/pool/main/a/automake-1.16/automake_1.16.5-1.3_all.deb && apt install ./automake_1.16.5-1.3_all.deb && \
|
||||
mv /src/oss-fuzz/projects/libxml2/all_harnesses/ /src/all_harnesses && \
|
||||
cp /src/oss-fuzz/projects/libxml2/build.sh /src/build.sh
|
||||
cp /src/oss-fuzz/projects/libxml2/build.sh /src/build.sh && \
|
||||
compile || exit 1
|
||||
|
||||
compile
|
||||
# Extract binary names from build.sh and run them
|
||||
BINARIES=$(grep -oP '(?<=-o \$OUT/)[^\s\\]+' /src/build.sh)
|
||||
|
||||
/out/xmlparseurisafe -max_total_time=10
|
||||
for binary in $BINARIES; do
|
||||
if [ -f "/out/$binary" ]; then
|
||||
echo "Running $binary..."
|
||||
savedcorpdir=/tmp/saved_corp_${binary}
|
||||
mkdir -p $savedcorpdir
|
||||
/out/$binary -runs=10000 $savedcorpdir /tmp/corpus >/dev/null 2>&1
|
||||
EXIT_CODE=$?
|
||||
|
||||
if [ $EXIT_CODE -ne 0 ]; then
|
||||
echo "Binary $binary crashed with exit code $EXIT_CODE"
|
||||
|
||||
# Find crash file in current directory
|
||||
CRASH_FILE=$(find . -maxdepth 1 -name "crash-*" -type f | head -n 1)
|
||||
|
||||
if [ -n "$CRASH_FILE" ]; then
|
||||
echo "Crash sample: $CRASH_FILE"
|
||||
echo "Base64 encoded crash sample:"
|
||||
base64 "$CRASH_FILE"
|
||||
fi
|
||||
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
else
|
||||
echo "Binary $binary not found, skipping..."
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user