Skip to content

Commit

Permalink
Add harness
Browse files Browse the repository at this point in the history
  • Loading branch information
rnshah9 authored and ForAllSecure Mayhem Bot committed Aug 25, 2024
1 parent bddbea8 commit cc21e61
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/mayhem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ jobs:
fail-fast: false
matrix:
mayhemfile:
- mayhem/Mayhemfile
- mayhem/Mayhemfile_cnip
- mayhem/Mayhemfile_fullDir

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 4 additions & 1 deletion mayhem/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
FROM --platform=linux/amd64 ubuntu:22.04 as builder

RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake clang

COPY . /repo
WORKDIR /repo/build
RUN cmake ..
RUN make -j8
WORKDIR /repo
RUN clang++ /repo/mayhem/fuzz.cpp utility/*.cpp tools/*.cpp -fsanitize=fuzzer -o /fuzz -Iutility/ -I.

FROM ubuntu:22.04 as package
COPY --from=builder /repo/build/cnip /
COPY --from=builder /repo/build/C/* /deps/
COPY --from=builder /repo/build/common/* /deps/
COPY --from=builder /fuzz /fuzz_fulldir
ENV LD_LIBRARY_PATH=/deps
File renamed without changes.
6 changes: 6 additions & 0 deletions mayhem/Mayhemfile_fullDir
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
project: psychec
target: fulldir

cmds:
- cmd: /fuzz_fullDir
libfuzzer: true
19 changes: 19 additions & 0 deletions mayhem/fuzz_fullDir.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <fuzzer/FuzzedDataProvider.h>
#include "utility/FileInfo.h"

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
FuzzedDataProvider provider(data, size);
std::string str = provider.ConsumeRandomLengthString();

psy::FileInfo fi(str);
fi.fullDir();

return 0;
}

0 comments on commit cc21e61

Please sign in to comment.