Skip to content

Commit

Permalink
fluent-bit: refine build (#10706)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidKorczynski authored Jul 13, 2023
1 parent d7b3fdd commit b45b2fc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions projects/fluent-bit/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ EOF

cd fluent-bit

# Avoid building tests we don't need
sed -i 's/prepare_unit_tests(flb/#prepare_unit_tests(flb/g' ./tests/internal/CMakeLists.txt

sed -i 's/malloc(/fuzz_malloc(/g' ./lib/msgpack-c/src/zone.c
sed -i 's/struct msgpack_zone_chunk {/void *fuzz_malloc(size_t size) {if (size > 0xa00000) return NULL;\nreturn malloc(size);}\nstruct msgpack_zone_chunk {/g' ./lib/msgpack-c/src/zone.c
# Patch files for fuzzing purposes. Only do if they have not already been patched.
if [ $(grep "fuzz" -ic ./lib/msgpack-c/src/zone.c) -eq 0 ]
then
# Avoid building tests we don't need
sed -i 's/prepare_unit_tests(flb/#prepare_unit_tests(flb/g' ./tests/internal/CMakeLists.txt
sed -i 's/malloc(/fuzz_malloc(/g' ./lib/msgpack-c/src/zone.c
sed -i 's/struct msgpack_zone_chunk {/void *fuzz_malloc(size_t size) {if (size > 0xa00000) return NULL;\nreturn malloc(size);}\nstruct msgpack_zone_chunk {/g' ./lib/msgpack-c/src/zone.c
fi

cd build
export CFLAGS="$CFLAGS -fcommon -DFLB_TESTS_OSSFUZZ=ON"
Expand Down

0 comments on commit b45b2fc

Please sign in to comment.