Skip to content
This repository was archived by the owner on Apr 30, 2021. It is now read-only.

Commit e265dd5

Browse files
author
Yevgeny Pats
committed
bugfix in mutation 14,15
1 parent c034023 commit e265dd5

File tree

4 files changed

+75
-3
lines changed

4 files changed

+75
-3
lines changed

examples/html/package-lock.json

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/html/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "html-fuzz",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "fuzz.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"htmlparser2": "^4.0.0"
13+
}
14+
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/corpus.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class Corpus {
8686
buf.copy(res, 0, 0, buf.length);
8787
const nm = 1 + this.exp2();
8888
for (let i=0; i<nm; i++) {
89-
const x = this.rand(14);
89+
const x = this.rand(16);
9090
if ( x ===0 ) {
9191
// Remove a range of bytes.
9292
if (res.length <= 1) {
@@ -284,10 +284,12 @@ export class Corpus {
284284
idx1++;
285285
}
286286
// If diffing parts are too small, there is no sense in splicing, rely on byte flipping.
287-
const diff = Math.min(res.length-idx0-idx1, other.length-idx0-idx1)
287+
const diff = Math.min(res.length-idx0-idx1, other.length-idx0-idx1);
288288
if (diff < 4) {
289289
i--;
290+
continue;
290291
}
292+
291293
other.copy(res, idx0, idx0, Math.min(other.length, idx0+this.rand(diff-2)+1))
292294
} else if (x === 15) {
293295
// Insert a part of another input.

0 commit comments

Comments
 (0)