File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 392392 dest = 'v8_options' ,
393393 help = 'v8 options to pass, see `node --v8-options` for examples.' )
394394
395+ parser .add_option ('--with-ossfuzz' ,
396+ action = 'store_true' ,
397+ dest = 'ossfuzz' ,
398+ help = 'Enables building of fuzzers. This command should be run in an OSS-Fuzz Docker image.' )
399+
395400parser .add_option ('--with-arm-float-abi' ,
396401 action = 'store' ,
397402 dest = 'arm_float_abi' ,
@@ -1770,6 +1775,9 @@ def make_bin_override():
17701775configure_static (output )
17711776configure_inspector (output )
17721777
1778+ # Forward OSS-Fuzz settings
1779+ output ['variables' ]['ossfuzz' ] = b (options .ossfuzz )
1780+
17731781# variables should be a root level element,
17741782# move everything else to target_defaults
17751783variables = output ['variables' ]
Original file line number Diff line number Diff line change 1212 'node_use_bundled_v8%' : 'true' ,
1313 'node_shared%' : 'false' ,
1414 'force_dynamic_crt%' : 0 ,
15+ 'ossfuzz' : 'false' ,
1516 'node_module_version%' : '' ,
1617 'node_shared_brotli%' : 'false' ,
1718 'node_shared_zlib%' : 'false' ,
11251126 } ],
11261127 ]
11271128 }, # specialize_node_d
1129+ { # fuzz_url
1130+ 'target_name' : 'fuzz_url' ,
1131+ 'type' : 'executable' ,
1132+ 'dependencies' : [
1133+ '<(node_lib_target_name)' ,
1134+ ],
1135+ 'includes' : [
1136+ 'node.gypi'
1137+ ],
1138+ 'include_dirs' : [
1139+ 'src' ,
1140+ ],
1141+ 'defines' : [
1142+ 'NODE_ARCH="<(target_arch)"' ,
1143+ 'NODE_PLATFORM="<(OS)"' ,
1144+ 'NODE_WANT_INTERNALS=1' ,
1145+ ],
1146+ 'sources' : [
1147+ 'src/node_snapshot_stub.cc' ,
1148+ 'src/node_code_cache_stub.cc' ,
1149+ 'test/fuzzers/fuzz_url.cc' ,
1150+ ],
1151+ 'conditions' : [
1152+ ['OS=="linux"' , {
1153+ 'ldflags' : [ '-fsanitize=fuzzer' ]
1154+ }],
1155+ # Ensure that ossfuzz flag has been set and that we are on Linux
1156+ [ 'OS!="linux" or ossfuzz!="true"' , {
1157+ 'type' : 'none' ,
1158+ }],
1159+ ],
1160+ }, # fuzz_url
11281161 {
11291162 'target_name' : 'cctest' ,
11301163 'type' : 'executable' ,
Original file line number Diff line number Diff line change 1+ #include < stdlib.h>
2+
3+ #include " node.h"
4+ #include " node_internals.h"
5+ #include " node_url.h"
6+
7+ extern " C" int LLVMFuzzerTestOneInput (const uint8_t * data, size_t size) {
8+ node::url::URL url2 (reinterpret_cast <const char *>(data), size);
9+
10+ return 0 ;
11+ }
You can’t perform that action at this time.
0 commit comments