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 381381 dest = 'v8_options' ,
382382 help = 'v8 options to pass, see `node --v8-options` for examples.' )
383383
384+ parser .add_option ('--with-ossfuzz' ,
385+ action = 'store_true' ,
386+ dest = 'ossfuzz' ,
387+ help = 'Enables building of fuzzers. This command should be run in an OSS-Fuzz Docker image.' )
388+
384389parser .add_option ('--with-arm-float-abi' ,
385390 action = 'store' ,
386391 dest = 'arm_float_abi' ,
@@ -1718,6 +1723,9 @@ def make_bin_override():
17181723configure_static (output )
17191724configure_inspector (output )
17201725
1726+ # Forward OSS-Fuzz settings
1727+ output ['variables' ]['ossfuzz' ] = b (options .ossfuzz )
1728+
17211729# variables should be a root level element,
17221730# move everything else to target_defaults
17231731variables = output ['variables' ]
Original file line number Diff line number Diff line change 1111 'node_use_bundled_v8%' : 'true' ,
1212 'node_shared%' : 'false' ,
1313 'force_dynamic_crt%' : 0 ,
14+ 'ossfuzz' : 'false' ,
1415 'node_module_version%' : '' ,
1516 'node_shared_brotli%' : 'false' ,
1617 'node_shared_zlib%' : 'false' ,
11071108 } ],
11081109 ]
11091110 }, # specialize_node_d
1111+ { # fuzz_url
1112+ 'target_name' : 'fuzz_url' ,
1113+ 'type' : 'executable' ,
1114+ 'dependencies' : [
1115+ '<(node_lib_target_name)' ,
1116+ ],
1117+ 'includes' : [
1118+ 'node.gypi'
1119+ ],
1120+ 'include_dirs' : [
1121+ 'src' ,
1122+ ],
1123+ 'defines' : [
1124+ 'NODE_ARCH="<(target_arch)"' ,
1125+ 'NODE_PLATFORM="<(OS)"' ,
1126+ 'NODE_WANT_INTERNALS=1' ,
1127+ ],
1128+ 'sources' : [
1129+ 'src/node_snapshot_stub.cc' ,
1130+ 'src/node_code_cache_stub.cc' ,
1131+ 'test/fuzzers/fuzz_url.cc' ,
1132+ ],
1133+ 'conditions' : [
1134+ ['OS=="linux"' , {
1135+ 'ldflags' : [ '-fsanitize=fuzzer' ]
1136+ }],
1137+ # Ensure that ossfuzz flag has been set and that we are on Linux
1138+ [ 'OS!="linux" or ossfuzz!="true"' , {
1139+ 'type' : 'none' ,
1140+ }],
1141+ ],
1142+ }, # fuzz_url
11101143 {
11111144 'target_name' : 'cctest' ,
11121145 '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