Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzz range branch #21

Open
wants to merge 21 commits into
base: master
from
Open
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

bugfix in resume from corpus/seed

  • Loading branch information
yevgenypats committed Nov 10, 2019
commit 93ce7619e61d6a326c43e371669ac4b1463c0c2f
@@ -30,7 +30,8 @@ const expected = [
'incorrect data check',
'invalid literal/length code',
'invalid bit length repeat',
'invalid code'
]
'invalid code',
'invalid literal'
];

exports.fuzz = fuzz
exports.fuzz = fuzz;

Some generated files are not rendered by default. Learn more.

@@ -1,6 +1,6 @@
{
"name": "jsfuzz",
"version": "1.0.12",
"version": "1.0.13",
"description": "Coverage Guided Javascript Fuzzer",
"main": "build/src/index.js",
"types": "build/src/inde.d.ts",
@@ -4,20 +4,24 @@ import {uint16, uint32} from "./math";
var crypto = require('crypto');

const INTERESTING8 = new Uint8Array([-128, -1, 0, 1, 16, 32, 64, 100, 127]);
const INTERESTING16 = new Uint16Array([-32768, -129, 128, 255, 256, 512, 1000, 1024, 4096, 32767]);
const INTERESTING32 = new Uint32Array([-2147483648, -100663046, -32769, 32768, 65535, 65536, 100663045, 2147483647]);
const INTERESTING16 = new Uint16Array([-32768, -129, 128, 255, 256, 512, 1000, 1024, 4096, 32767, -128, -1, 0, 1, 16, 32, 64, 100, 127]);
const INTERESTING32 = new Uint32Array([-2147483648, -100663046, -32769, 32768, 65535, 65536, 100663045, 2147483647, -32768, -129, 128, 255, 256, 512, 1000, 1024, 4096, 32767]);


export class Corpus {
private inputs: Buffer[];
private seedPath: string | undefined;
private corpusPath: string | undefined;
private maxInputSize: number;
private seedLength: number;

constructor(dir: string[]) {
this.inputs = [];
this.maxInputSize = 4096;
for (let i of dir) {
if (!fs.existsSync(i)) {
fs.mkdirSync(i);
}
if (fs.lstatSync(i).isDirectory()) {
if (!this.corpusPath) {
this.corpusPath = i;
@@ -27,6 +31,7 @@ export class Corpus {
this.inputs.push(fs.readFileSync(i));
}
}
this.seedLength = this.inputs.length;

}

@@ -42,8 +47,12 @@ export class Corpus {
}

generateInput() {
if (this.seedLength > 0) {
this.seedLength -= 1;
return this.inputs[this.seedLength];
}
if (this.inputs.length === 0) {
const buf = Buffer.alloc(0, 0)
const buf = Buffer.alloc(0, 0);
this.putBuffer(buf);
return buf;
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.