-
Notifications
You must be signed in to change notification settings - Fork 952
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
OSS-Fuzz targets improvements #267
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
94fea3e
Move fuzz target sources from the oss-fuzz repository here
renatahodovan 6ca3f9f
Add support to build libFuzzer targets
renatahodovan 6bf1444
Small no-op improvements in the fuzz targets
renatahodovan 293baf9
Simplify the fuzz_eval and fuzz_compile targets
renatahodovan 349fb69
Simplify the fuzz_regexp target
renatahodovan 9335cbc
Recreate and destroy JS runtime and context in fuzz_eval and fuzz_com…
renatahodovan 5b24c1a
Enable bignumber support in eval and compile targets
renatahodovan 75e803a
Ensure std and os modules are available in the fuzz_eval and fuzz_com…
renatahodovan c4977c7
Add fuzzer dictionary with builtin and variable names
renatahodovan 1dd4c33
Move common fuzzer code into one place
renatahodovan 993b1d0
Enable to define the LIB_FUZZING_ENGINE variable to ease the oss-fuzz…
renatahodovan 61a614f
Add README to fuzzers
renatahodovan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
libFuzzer support for QuickJS | ||
============================= | ||
|
||
Build QuickJS with libFuzzer support as follows: | ||
|
||
CONFIG_CLANG=y make libfuzzer | ||
|
||
This can be extended with sanitizer support to improve efficacy: | ||
|
||
CONFIG_CLANG=y CONFIG_ASAN=y make libfuzzer | ||
|
||
|
||
Currently, there are three fuzzing targets defined: fuzz_eval, fuzz_compile and fuzz_regexp. | ||
The above build command will produce an executable binary for each of them, which can be | ||
simply executed as: | ||
|
||
./fuzz_eval | ||
|
||
or with an initial corpus: | ||
|
||
./fuzz_compile corpus_dir/ | ||
|
||
or with a predefined dictionary to improve its efficacy: | ||
|
||
./fuzz_eval -dict fuzz/fuzz.dict | ||
|
||
or with arbitrary CLI arguments provided by libFuzzer (https://llvm.org/docs/LibFuzzer.html). |
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,257 @@ | ||
"__loadScript" | ||
"abs" | ||
"acos" | ||
"acosh" | ||
"add" | ||
"AggregateError" | ||
"and" | ||
"apply" | ||
"Array" | ||
"ArrayBuffer" | ||
"asin" | ||
"asinh" | ||
"atan" | ||
"atan2" | ||
"atanh" | ||
"Atomics" | ||
"BigDecimal" | ||
"BigFloat" | ||
"BigFloatEnv" | ||
"BigInt" | ||
"BigInt64Array" | ||
"BigUint64Array" | ||
"Boolean" | ||
"cbrt" | ||
"ceil" | ||
"chdir" | ||
"clearTimeout" | ||
"close" | ||
"clz32" | ||
"compareExchange" | ||
"console" | ||
"construct" | ||
"cos" | ||
"cosh" | ||
"DataView" | ||
"Date" | ||
"decodeURI" | ||
"decodeURIComponent" | ||
"defineProperty" | ||
"deleteProperty" | ||
"dup" | ||
"dup2" | ||
"E" | ||
"encodeURI" | ||
"encodeURIComponent" | ||
"err" | ||
"Error" | ||
"escape" | ||
"eval" | ||
"EvalError" | ||
"evalScript" | ||
"exchange" | ||
"exec" | ||
"exit" | ||
"exp" | ||
"expm1" | ||
"fdopen" | ||
"Float32Array" | ||
"Float64Array" | ||
"floor" | ||
"fround" | ||
"Function" | ||
"gc" | ||
"get" | ||
"getcwd" | ||
"getenv" | ||
"getenviron" | ||
"getOwnPropertyDescriptor" | ||
"getpid" | ||
"getPrototypeOf" | ||
"globalThis" | ||
"has" | ||
"hypot" | ||
"imul" | ||
"in" | ||
"Infinity" | ||
"Int16Array" | ||
"Int32Array" | ||
"Int8Array" | ||
"InternalError" | ||
"isatty" | ||
"isExtensible" | ||
"isFinite" | ||
"isLockFree" | ||
"isNaN" | ||
"iterateBuiltIns" | ||
"JSON" | ||
"kill" | ||
"length" | ||
"LN10" | ||
"LN2" | ||
"load" | ||
"loadFile" | ||
"loadScript" | ||
"log" | ||
"log10" | ||
"LOG10E" | ||
"log1p" | ||
"log2" | ||
"LOG2E" | ||
"lstat" | ||
"Map" | ||
"Math" | ||
"max" | ||
"min" | ||
"mkdir" | ||
"NaN" | ||
"notify" | ||
"now" | ||
"Number" | ||
"O_APPEND" | ||
"O_CREAT" | ||
"O_EXCL" | ||
"O_RDONLY" | ||
"O_RDWR" | ||
"O_TRUNC" | ||
"O_WRONLY" | ||
"Object" | ||
"open" | ||
"Operators" | ||
"or" | ||
"os" | ||
"out" | ||
"ownKeys" | ||
"parse" | ||
"parseExtJSON" | ||
"parseFloat" | ||
"parseInt" | ||
"PI" | ||
"pipe" | ||
"platform" | ||
"popen" | ||
"pow" | ||
"preventExtensions" | ||
"print" | ||
"printf" | ||
"Promise" | ||
"Proxy" | ||
"puts" | ||
"random" | ||
"RangeError" | ||
"read" | ||
"readdir" | ||
"readlink" | ||
"realpath" | ||
"ReferenceError" | ||
"Reflect" | ||
"RegExp" | ||
"remove" | ||
"rename" | ||
"round" | ||
"S_IFBLK" | ||
"S_IFCHR" | ||
"S_IFDIR" | ||
"S_IFIFO" | ||
"S_IFLNK" | ||
"S_IFMT" | ||
"S_IFREG" | ||
"S_IFSOCK" | ||
"S_ISGID" | ||
"S_ISUID" | ||
"scriptArgs" | ||
"seek" | ||
"SEEK_CUR" | ||
"SEEK_END" | ||
"SEEK_SET" | ||
"set" | ||
"Set" | ||
"setenv" | ||
"setPrototypeOf" | ||
"setReadHandler" | ||
"setTimeout" | ||
"setWriteHandler" | ||
"SharedArrayBuffer" | ||
"SIGABRT" | ||
"SIGALRM" | ||
"SIGCHLD" | ||
"SIGCONT" | ||
"SIGFPE" | ||
"SIGILL" | ||
"SIGINT" | ||
"sign" | ||
"signal" | ||
"SIGPIPE" | ||
"SIGQUIT" | ||
"SIGSEGV" | ||
"SIGSTOP" | ||
"SIGTERM" | ||
"SIGTSTP" | ||
"SIGTTIN" | ||
"SIGTTOU" | ||
"SIGUSR1" | ||
"SIGUSR2" | ||
"sin" | ||
"sinh" | ||
"sleep" | ||
"sleepAsync" | ||
"sprintf" | ||
"sqrt" | ||
"SQRT1_2" | ||
"SQRT2" | ||
"stat" | ||
"std" | ||
"store" | ||
"strerror" | ||
"String" | ||
"stringify" | ||
"sub" | ||
"Symbol" | ||
"symlink" | ||
"SyntaxError" | ||
"tan" | ||
"tanh" | ||
"tmpfile" | ||
"trunc" | ||
"ttyGetWinSize" | ||
"ttySetRaw" | ||
"TypeError" | ||
"Uint16Array" | ||
"Uint32Array" | ||
"Uint8Array" | ||
"Uint8ClampedArray" | ||
"undefined" | ||
"unescape" | ||
"unsetenv" | ||
"URIError" | ||
"urlGet" | ||
"utimes" | ||
"wait" | ||
"waitpid" | ||
"WeakMap" | ||
"WeakSet" | ||
"WNOHANG" | ||
"Worker" | ||
"write" | ||
"xor" | ||
"v0" | ||
"v1" | ||
"v2" | ||
"v3" | ||
"v4" | ||
"v5" | ||
"v6" | ||
"v7" | ||
"v8" | ||
"v9" | ||
"v10" | ||
"v11" | ||
"v12" | ||
"v13" | ||
"v14" | ||
"v15" | ||
"v16" | ||
"v17" | ||
"v18" | ||
"v19" | ||
"v20" |
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,22 @@ | ||
/* Copyright 2020 Google Inc. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#include "quickjs.h" | ||
#include "quickjs-libc.h" | ||
|
||
static int nbinterrupts = 0; | ||
|
||
void reset_nbinterrupts(); | ||
void test_one_input_init(JSRuntime *rt, JSContext *ctx); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this dict created? If automated, is it possible to check-in the script that does so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The names were collected with a JS script, I'll upload it in the next round.