summaryrefslogtreecommitdiff
path: root/node.gyp
diff options
context:
space:
mode:
authordavkor <david@adalogics.com>2020-08-13 17:12:44 +0100
committerRich Trott <rtrott@gmail.com>2020-08-15 14:59:07 -0700
commit375b859428e1c525f0cc9d3c4324f51740316722 (patch)
tree6f193b56793b3ed58522ecee321d732a69b3c54b /node.gyp
parent5d179cb2eccac38205b6f03ecf6403df65deea51 (diff)
downloadios-node-v8-375b859428e1c525f0cc9d3c4324f51740316722.tar.gz
ios-node-v8-375b859428e1c525f0cc9d3c4324f51740316722.tar.bz2
ios-node-v8-375b859428e1c525f0cc9d3c4324f51740316722.zip
build: add build flag for OSS-Fuzz integration
Refs: https://github.com/google/oss-fuzz/pull/3860 Fixes: https://github.com/nodejs/node/issues/33724 PR-URL: https://github.com/nodejs/node/pull/34761 Fixes: https://github.com/nodejs/node/issues/33724 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'node.gyp')
-rw-r--r--node.gyp33
1 files changed, 33 insertions, 0 deletions
diff --git a/node.gyp b/node.gyp
index f198bc6cf5..22c270123f 100644
--- a/node.gyp
+++ b/node.gyp
@@ -13,6 +13,7 @@
'node_use_bundled_v8%': 'true',
'node_shared%': 'false',
'force_dynamic_crt%': 0,
+ 'ossfuzz' : 'false',
'node_module_version%': '',
'node_shared_brotli%': 'false',
'node_shared_zlib%': 'false',
@@ -1170,6 +1171,38 @@
} ],
]
}, # specialize_node_d
+ { # fuzz_url
+ 'target_name': 'fuzz_url',
+ 'type': 'executable',
+ 'dependencies': [
+ '<(node_lib_target_name)',
+ ],
+ 'includes': [
+ 'node.gypi'
+ ],
+ 'include_dirs': [
+ 'src',
+ ],
+ 'defines': [
+ 'NODE_ARCH="<(target_arch)"',
+ 'NODE_PLATFORM="<(OS)"',
+ 'NODE_WANT_INTERNALS=1',
+ ],
+ 'sources': [
+ 'src/node_snapshot_stub.cc',
+ 'src/node_code_cache_stub.cc',
+ 'test/fuzzers/fuzz_url.cc',
+ ],
+ 'conditions': [
+ ['OS=="linux"', {
+ 'ldflags': [ '-fsanitize=fuzzer' ]
+ }],
+ # Ensure that ossfuzz flag has been set and that we are on Linux
+ [ 'OS!="linux" or ossfuzz!="true"', {
+ 'type': 'none',
+ }],
+ ],
+ }, # fuzz_url
{
'target_name': 'cctest',
'type': 'executable',