Skip to content

Commit

Permalink
Avoid gzip functions when fuzzing in OSS and add zlib dependency when…
Browse files Browse the repository at this point in the history
… fuzzing locally.
  • Loading branch information
atoppi committed Nov 27, 2019
1 parent fc818eb commit bfb1560
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fuzzers/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ DEPS_CFLAGS="$(pkg-config --cflags glib-2.0)"

# Libraries to link in with fuzzers
DEPS_LIB="-Wl,-Bstatic $(pkg-config --libs glib-2.0 jansson) -pthread -Wl,-Bdynamic"
DEPS_LIB_SHARED="$(pkg-config --libs glib-2.0 jansson) -pthread"
DEPS_LIB_SHARED="$(pkg-config --libs glib-2.0 jansson zlib) -pthread"
2 changes: 2 additions & 0 deletions utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,7 @@ inline void janus_set4(guint8 *data,size_t i,guint32 val) {
data[i] = (guint8)(val>>24);
}

#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
size_t janus_gzip_compress(int compression, char *text, size_t tlen, char *compressed, size_t zlen) {
if(text == NULL || tlen < 1 || compressed == NULL || zlen < 1)
return -1;
Expand Down Expand Up @@ -1063,3 +1064,4 @@ size_t janus_gzip_compress(int compression, char *text, size_t tlen, char *compr
/* Done, return the size of the compressed data */
return zs.total_out;
}
#endif

0 comments on commit bfb1560

Please sign in to comment.