-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94a46a4
commit 56f3e7b
Showing
13 changed files
with
654 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ Cargo.lock | |
*.swp | ||
node_modules | ||
*/node_modules/* | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"cflags": [ "-fexceptions -fsanitize=address,fuzzer-no-link -O0 -g -fPIC -I/usr/lib/llvm-10/lib/clang/10.0.0/lib/linux/ -lclang_rt.fuzzer-x86_64" ], | ||
"cflags_cc": [ "-fexceptions -fsanitize=address,fuzzer-no-link -O0 -g -fPIC -I/usr/lib/llvm-10/lib/clang/10.0.0/lib/linux/ -lclang_rt.fuzzer-x86_64" ], | ||
"include_dirs" : ["<!@(node -p \"require('node-addon-api').include\")"], | ||
"target_name": "native", | ||
"sources": [ "native.cpp" ], | ||
'defines': [ 'NAPI_CPP_EXCEPTIONS' ] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <napi.h> | ||
#include <stdio.h> | ||
|
||
void foo(const Napi::CallbackInfo &info) | ||
{ | ||
Napi::Env env = info.Env(); | ||
uint8_t buf[] = {1, 2, 3}; | ||
Napi::Buffer<uint8_t> arr = Napi::Buffer<uint8_t>::New(env, &buf[0], 3); | ||
arr[5u] = 1; | ||
printf("Number: %u\n", arr[5u]); | ||
// throw Napi::String::New(env, "error in native lib"); | ||
} | ||
|
||
Napi::Object init(Napi::Env env, Napi::Object exports) | ||
{ | ||
exports.Set(Napi::String::New(env, "foo"), Napi::Function::New(env, foo)); | ||
return exports; | ||
}; | ||
|
||
NODE_API_MODULE(native, init); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function bar() { | ||
new Function(` | ||
throw new Error('internal'); | ||
`)(); | ||
} | ||
|
||
function foo() { | ||
bar(); | ||
} | ||
|
||
function main() { | ||
foo(); | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
function bar() { | ||
new Function(` | ||
throw new Error('internal'); | ||
`)(); | ||
} | ||
|
||
function foo() { | ||
bar(); | ||
} | ||
|
||
function fuzz(data) { | ||
foo(); | ||
} | ||
|
||
module.exports.fuzz = function (data /*: Buffer */) { | ||
const fuzzerData = data.toString(); | ||
fuzz(fuzzerData); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function bar() { | ||
new Function(` | ||
throw new Error('internal'); | ||
`)(); | ||
} | ||
|
||
function foo() { | ||
bar(); | ||
} | ||
|
||
function fuzz(data) { | ||
foo(); | ||
} | ||
|
||
module.exports = { | ||
fuzz | ||
}; | ||
|
||
fuzz(process.argv[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env node | ||
|
||
const native_lib = require('bindings')('native') | ||
|
||
native_lib.foo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const native_lib = require('bindings')('native') | ||
|
||
function fuzz(data) { | ||
native_lib.foo(); | ||
} | ||
|
||
module.exports.fuzz = function (data /*: Buffer */) { | ||
const fuzzerData = data.toString(); | ||
fuzz(fuzzerData); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const native_lib = require('bindings')('native') | ||
|
||
function fuzz(data) { | ||
native_lib.foo(); | ||
} | ||
|
||
module.exports = { | ||
fuzz | ||
}; | ||
|
||
fuzz(process.argv[1]); |
Oops, something went wrong.