Skip to content

Commit

Permalink
Make CFL use re2 instead of std::regex to prevent timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
eliaskosunen committed Nov 7, 2024
1 parent d815877 commit e8ab15a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .clusterfuzzlite/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ RUN apt update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN git clone --depth 1 --branch 20240722.0 https://github.com/abseil/abseil-cpp $SRC/abseil && \
cd $SRC/abseil-cpp && \
mkdir build && cd build && \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON .. && \
cmake --build . --target install && \
cd ../.. && rm -rf $SRC/abseil \

RUN git clone --depth 1 --branch 2024-07-02 https://github.com/google/re2 $SRC/re2 && \
cd $SRC/re2 && \
mkdir build && cd build && \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON .. && \
cmake --build . --target install && \
cd ../.. && rm -rf $SRC/re2 \

COPY . $SRC/scnlib
WORKDIR $SRC/scnlib
COPY ./.clusterfuzzlite/build.sh $SRC/
7 changes: 5 additions & 2 deletions .clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/bin/bash -eu
#!/usr/bin/env bash

set -xeu

mkdir build
cd build

cmake .. \
-G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=17 \
-DSCN_DISABLE_TOP_PROJECT=ON -DSCN_FUZZING=ON \
-DSCN_FUZZING_LDFLAGS="$LIB_FUZZING_ENGINE"
-DSCN_FUZZING_LDFLAGS="$LIB_FUZZING_ENGINE" \
-DSCN_REGEX_BACKEND=re2

cmake --build .

Expand Down
1 change: 1 addition & 0 deletions tests/fuzz/fuzz.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <scn/scan.h>
#include <scn/xchar.h>

#include <deque>
#include <sstream>

namespace scn::fuzz {
Expand Down

0 comments on commit e8ab15a

Please sign in to comment.