Skip to content

Commit

Permalink
Merge branch 'beltoforion:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
lformaggia authored Jan 8, 2024
2 parents aa5f6a9 + f014908 commit f351a52
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .clusterfuzzlite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y make autoconf automake libtool

COPY . $SRC/muparserx
COPY .clusterfuzzlite/build.sh $SRC/build.sh
WORKDIR $SRC/muparserx
3 changes: 3 additions & 0 deletions .clusterfuzzlite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ClusterFuzzLite set up

This folder contains a fuzzing set for [ClusterFuzzLite](https://google.github.io/clusterfuzzlite).
14 changes: 14 additions & 0 deletions .clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash -eu

mkdir build
cd build
cmake ../
make

# Copy all fuzzer executables to $OUT/
$CXX $CFLAGS $LIB_FUZZING_ENGINE \
$SRC/muparserx/.clusterfuzzlite/parser_fuzzer.cpp \
-stdlib=libc++ -std=c++17 \
-o $OUT/parser_fuzzer \
-I$SRC/muparserx/parser \
$SRC/muparserx/build/libmuparserx.a
17 changes: 17 additions & 0 deletions .clusterfuzzlite/parser_fuzzer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "mpParser.h"
#include <string>

using namespace mup;

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
std::string fuzz_input(reinterpret_cast<const char *>(data), size);
ParserX p;

try {
p.SetExpr(fuzz_input);
p.Eval();
} catch (...) {
}

return 0;
}
1 change: 1 addition & 0 deletions .clusterfuzzlite/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
language: c++
30 changes: 30 additions & 0 deletions .github/workflows/cflite_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: ClusterFuzzLite PR fuzzing
on:
workflow_dispatch:
pull_request:
branches: [ main ]
permissions: read-all
jobs:
PR:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sanitizer: [address]
steps:
- name: Build Fuzzers (${{ matrix.sanitizer }})
id: build
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
with:
sanitizer: ${{ matrix.sanitizer }}
language: c++
bad-build-check: false
- name: Run Fuzzers (${{ matrix.sanitizer }})
id: run
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fuzz-seconds: 180
mode: 'code-change'
report-unreproducible-crashes: false
sanitizer: ${{ matrix.sanitizer }}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 3.3)
cmake_minimum_required(VERSION 3.17)
project(muparserx CXX)

########################################################################
Expand Down

0 comments on commit f351a52

Please sign in to comment.