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 Jan 2, 2025
1 parent 2bc207a commit 7f58bae
Show file tree
Hide file tree
Showing 5 changed files with 27 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_Pad
- mayhem/Mayhemfile_dump

steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions mayhem/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential clang libc
COPY . /repo
WORKDIR /repo
RUN g++ ISOBMFF-Dump/main.cpp /repo/ISOBMFF/source/* -I /repo/ISOBMFF/include/ -o dump
RUN make -j8
RUN clang++ /repo/mayhem/fuzz_Pad.cpp -fsanitize=fuzzer,address /repo/ISOBMFF/source/* -I /repo/ISOBMFF/include/ -o /fuzz

FROM ubuntu:22.04 as package
COPY --from=builder /repo/dump /
COPY --from=builder /fuzz /fuzz_Pad
6 changes: 6 additions & 0 deletions mayhem/Mayhemfile_Pad
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
project: isobmff
target: pad

cmds:
- cmd: /fuzz_Pad
libfuzzer: true
1 change: 0 additions & 1 deletion mayhem/Mayhemfile → mayhem/Mayhemfile_dump
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ testsuite:

cmds:
- cmd: /dump @@
image: ghcr.io/rnshah9/playground:isobmff
16 changes: 16 additions & 0 deletions mayhem/fuzz_Pad.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdint.h>
#include <stdio.h>
#include <climits>

#include <fuzzer/FuzzedDataProvider.h>

#include "ISOBMFF/Utils.hpp"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
FuzzedDataProvider provider(data, size);
std::string s = provider.ConsumeRandomLengthString();
size_t length = provider.ConsumeIntegralInRange(0, 1000);

ISOBMFF::Utils::Pad(s, length);
return 0;
}

0 comments on commit 7f58bae

Please sign in to comment.