File tree 3 files changed +52
-0
lines changed
3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 381
381
dest = 'v8_options' ,
382
382
help = 'v8 options to pass, see `node --v8-options` for examples.' )
383
383
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
+
384
389
parser .add_option ('--with-arm-float-abi' ,
385
390
action = 'store' ,
386
391
dest = 'arm_float_abi' ,
@@ -1718,6 +1723,9 @@ def make_bin_override():
1718
1723
configure_static (output )
1719
1724
configure_inspector (output )
1720
1725
1726
+ # Forward OSS-Fuzz settings
1727
+ output ['variables' ]['ossfuzz' ] = b (options .ossfuzz )
1728
+
1721
1729
# variables should be a root level element,
1722
1730
# move everything else to target_defaults
1723
1731
variables = output ['variables' ]
Original file line number Diff line number Diff line change 11
11
'node_use_bundled_v8%' : 'true' ,
12
12
'node_shared%' : 'false' ,
13
13
'force_dynamic_crt%' : 0 ,
14
+ 'ossfuzz' : 'false' ,
14
15
'node_module_version%' : '' ,
15
16
'node_shared_brotli%' : 'false' ,
16
17
'node_shared_zlib%' : 'false' ,
1107
1108
} ],
1108
1109
]
1109
1110
}, # 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
1110
1143
{
1111
1144
'target_name' : 'cctest' ,
1112
1145
'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