| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 952f233 commit bdf26ae
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -392,6 +392,11 @@ | |||
| 392 | 392 | dest='v8_options', | |
| 393 | 393 | help='v8 options to pass, see `node --v8-options` for examples.') | |
| 394 | 394 | ||
| 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 | + | ||
| 395 | 400 | parser.add_option('--with-arm-float-abi', | |
| 396 | 401 | action='store', | |
| 397 | 402 | dest='arm_float_abi', | |
@@ -1770,6 +1775,9 @@ def make_bin_override(): | |||
| 1770 | 1775 | configure_static(output) | |
| 1771 | 1776 | configure_inspector(output) | |
| 1772 | 1777 | ||
| 1778 | + # Forward OSS-Fuzz settings | ||
| 1779 | + output['variables']['ossfuzz'] = b(options.ossfuzz) | ||
| 1780 | + | ||
| 1773 | 1781 | # variables should be a root level element, | |
| 1774 | 1782 | # move everything else to target_defaults | |
| 1775 | 1783 | variables = output['variables'] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,7 @@ | |||
| 12 | 12 | 'node_use_bundled_v8%': 'true', | |
| 13 | 13 | 'node_shared%': 'false', | |
| 14 | 14 | 'force_dynamic_crt%': 0, | |
| 15 | + 'ossfuzz' : 'false', | ||
| 15 | 16 | 'node_module_version%': '', | |
| 16 | 17 | 'node_shared_brotli%': 'false', | |
| 17 | 18 | 'node_shared_zlib%': 'false', | |
@@ -1125,6 +1126,38 @@ | |||
| 1125 | 1126 | } ], | |
| 1126 | 1127 | ] | |
| 1127 | 1128 | }, # 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 | ||
| 1128 | 1161 | { | |
| 1129 | 1162 | 'target_name': 'cctest', | |
| 1130 | 1163 | 'type': 'executable', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,11 @@ | |||
| 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 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments