mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Edit fuzz' .c files to be C, not C++
This commit is contained in:
1 parent
5ad9055572
commit
2a97a1ad29
4 files changed
+16
-8
No files matched your search
@@ -28,7 +28,11 @@ void intentional_segfault() {
|
||||
|
||||
void fuzz(wuffs_base__io_reader src_reader, uint32_t hash);
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
// Hash input as per https://en.wikipedia.org/wiki/Jenkins_hash_function
|
||||
size_t i = 0;
|
||||
uint32_t hash = 0;
|
||||
@@ -50,6 +54,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#ifdef WUFFS_CONFIG__FUZZLIB_MAIN
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
This directory contains multiple programs to fuzz Wuffs' implementations of
|
||||
various codecs. For example, `gif_fuzzer.cc` is a program to fuzz Wuffs' GIF
|
||||
various codecs. For example, `gif_fuzzer.c` is a program to fuzz Wuffs' GIF
|
||||
implementation.
|
||||
|
||||
They are typically run indirectly, by a fuzzing framework such as
|
||||
@@ -9,5 +9,5 @@ directory's code.
|
||||
|
||||
When working on these files, it is possible to run them directly on an explicit
|
||||
test suite, in order to speed up the edit-compile-run cycle. Look for
|
||||
`WUFFS_CONFIG__FUZZLIB_MAIN` in the C++ code for more details, and in
|
||||
`seed_corpora.txt` for suggested test data.
|
||||
`WUFFS_CONFIG__FUZZLIB_MAIN` for more details, and in `seed_corpora.txt` for
|
||||
suggested test data.
|
||||
@@ -23,7 +23,7 @@ such as https://github.com/google/oss-fuzz calling LLVMFuzzerTestOneInput.
|
||||
When working on the fuzz implementation, or as a sanity check, defining
|
||||
WUFFS_CONFIG__FUZZLIB_MAIN will let you manually run fuzz over a set of files:
|
||||
|
||||
g++ -DWUFFS_CONFIG__FUZZLIB_MAIN gif_fuzzer.cc
|
||||
gcc -DWUFFS_CONFIG__FUZZLIB_MAIN gif_fuzzer.c
|
||||
./a.out ../../../test/data/*.gif
|
||||
rm -f ./a.out
|
||||
|
||||
@@ -36,7 +36,7 @@ It should print "PASS", amongst other information, and exit(0).
|
||||
// relative includes, you can use the script/inline-c-relative-includes.go
|
||||
// program to generate a stand-alone C file.
|
||||
#include "../../../gen/c/std/gif.c"
|
||||
#include "../fuzzlib/fuzzlib.cc"
|
||||
#include "../fuzzlib/fuzzlib.c"
|
||||
|
||||
void fuzz(wuffs_base__io_reader src_reader, uint32_t hash) {
|
||||
void* pixbuf = NULL;
|
||||
|
||||
@@ -23,7 +23,7 @@ such as https://github.com/google/oss-fuzz calling LLVMFuzzerTestOneInput.
|
||||
When working on the fuzz implementation, or as a sanity check, defining
|
||||
WUFFS_CONFIG__FUZZLIB_MAIN will let you manually run fuzz over a set of files:
|
||||
|
||||
g++ -DWUFFS_CONFIG__FUZZLIB_MAIN zlib_fuzzer.cc
|
||||
gcc -DWUFFS_CONFIG__FUZZLIB_MAIN zlib_fuzzer.c
|
||||
./a.out ../../../test/data/*.zlib
|
||||
rm -f ./a.out
|
||||
|
||||
@@ -38,7 +38,7 @@ It should print "PASS", amongst other information, and exit(0).
|
||||
#include "../../../gen/c/std/adler32.c"
|
||||
#include "../../../gen/c/std/deflate.c"
|
||||
#include "../../../gen/c/std/zlib.c"
|
||||
#include "../fuzzlib/fuzzlib.cc"
|
||||
#include "../fuzzlib/fuzzlib.c"
|
||||
|
||||
void fuzz(wuffs_base__io_reader src_reader, uint32_t hash) {
|
||||
wuffs_zlib__status s;
|
||||
|
||||
Reference in new issue
Block a user