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 439
439
dest = 'v8_options' ,
440
440
help = 'v8 options to pass, see `node --v8-options` for examples.' )
441
441
442
+ parser .add_option ('--with-ossfuzz' ,
443
+ action = 'store_true' ,
444
+ dest = 'ossfuzz' ,
445
+ help = 'Enables building of fuzzers. This command should be run in an OSS-Fuzz Docker image.' )
446
+
442
447
parser .add_option ('--with-arm-float-abi' ,
443
448
action = 'store' ,
444
449
dest = 'arm_float_abi' ,
@@ -1827,6 +1832,9 @@ def make_bin_override():
1827
1832
configure_static (output )
1828
1833
configure_inspector (output )
1829
1834
1835
+ # Forward OSS-Fuzz settings
1836
+ output ['variables' ]['ossfuzz' ] = b (options .ossfuzz )
1837
+
1830
1838
# variables should be a root level element,
1831
1839
# move everything else to target_defaults
1832
1840
variables = output ['variables' ]
Original file line number Diff line number Diff line change 13
13
'node_use_bundled_v8%' : 'true' ,
14
14
'node_shared%' : 'false' ,
15
15
'force_dynamic_crt%' : 0 ,
16
+ 'ossfuzz' : 'false' ,
16
17
'node_module_version%' : '' ,
17
18
'node_shared_brotli%' : 'false' ,
18
19
'node_shared_zlib%' : 'false' ,
1170
1171
} ],
1171
1172
]
1172
1173
}, # specialize_node_d
1174
+ { # fuzz_url
1175
+ 'target_name' : 'fuzz_url' ,
1176
+ 'type' : 'executable' ,
1177
+ 'dependencies' : [
1178
+ '<(node_lib_target_name)' ,
1179
+ ],
1180
+ 'includes' : [
1181
+ 'node.gypi'
1182
+ ],
1183
+ 'include_dirs' : [
1184
+ 'src' ,
1185
+ ],
1186
+ 'defines' : [
1187
+ 'NODE_ARCH="<(target_arch)"' ,
1188
+ 'NODE_PLATFORM="<(OS)"' ,
1189
+ 'NODE_WANT_INTERNALS=1' ,
1190
+ ],
1191
+ 'sources' : [
1192
+ 'src/node_snapshot_stub.cc' ,
1193
+ 'src/node_code_cache_stub.cc' ,
1194
+ 'test/fuzzers/fuzz_url.cc' ,
1195
+ ],
1196
+ 'conditions' : [
1197
+ ['OS=="linux"' , {
1198
+ 'ldflags' : [ '-fsanitize=fuzzer' ]
1199
+ }],
1200
+ # Ensure that ossfuzz flag has been set and that we are on Linux
1201
+ [ 'OS!="linux" or ossfuzz!="true"' , {
1202
+ 'type' : 'none' ,
1203
+ }],
1204
+ ],
1205
+ }, # fuzz_url
1173
1206
{
1174
1207
'target_name' : 'cctest' ,
1175
1208
'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