This repository was archived by the owner on Apr 30, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +33
-2
lines changed Expand file tree Collapse file tree 5 files changed +33
-2
lines changed Original file line number Diff line number Diff line change
1
+ # These are supported funding model platforms
2
+
3
+ github : yevgenypats
4
+
Original file line number Diff line number Diff line change @@ -148,5 +148,6 @@ any unnecessary work is done.
148
148
* [ js-yaml: Crash/TypeError] ( https://github.com/nodeca/js-yaml/issues/525 )
149
149
* [ asciidoctor: Hang/DoS] ( https://github.com/asciidoctor/asciidoctor/issues/3472 )
150
150
* [ deanm/omggif: Crash/TypeError] ( https://github.com/deanm/omggif/issues/41 )
151
+ * [ Leonidas-from-XIV/node-xml2js: Crash/TypeError] ( https://github.com/Leonidas-from-XIV/node-xml2js/issues/544 )
151
152
152
153
** Feel free to add bugs that you found with jsfuzz to this list via pull-request**
Original file line number Diff line number Diff line change @@ -13,9 +13,11 @@ export class Corpus {
13
13
private corpusPath : string | undefined ;
14
14
private maxInputSize : number ;
15
15
private seedLength : number ;
16
+ private readonly onlyAscii : boolean ;
16
17
17
- constructor ( dir : string [ ] ) {
18
+ constructor ( dir : string [ ] , onlyAscii : boolean ) {
18
19
this . inputs = [ ] ;
20
+ this . onlyAscii = onlyAscii ;
19
21
this . maxInputSize = 4096 ;
20
22
for ( let i of dir ) {
21
23
if ( ! fs . existsSync ( i ) ) {
@@ -106,6 +108,16 @@ export class Corpus {
106
108
}
107
109
}
108
110
111
+ toAscii ( buf : Buffer ) {
112
+ let x ;
113
+ for ( let i = 0 ; i < buf . length ; i ++ ) {
114
+ x = buf [ i ] & 127 ;
115
+ if ( ( x < 0x20 || x > 0x7E ) && x !== 0x09 && ( x < 0xA || x > 0xD ) ) {
116
+ buf [ i ] = 0x20 ;
117
+ }
118
+ }
119
+ }
120
+
109
121
mutate ( buf : Buffer ) {
110
122
let res = Buffer . allocUnsafe ( buf . length ) ;
111
123
buf . copy ( res , 0 , 0 , buf . length ) ;
@@ -341,6 +353,11 @@ export class Corpus {
341
353
if ( res . length > this . maxInputSize ) {
342
354
res = res . slice ( 0 , this . maxInputSize )
343
355
}
356
+
357
+ if ( this . onlyAscii ) {
358
+ this . toAscii ( res ) ;
359
+ }
360
+
344
361
return res ;
345
362
}
346
363
}
Original file line number Diff line number Diff line change @@ -33,16 +33,19 @@ export class Fuzzer {
33
33
private regression : boolean ;
34
34
private verse : Verse | null ;
35
35
private readonly versifier : boolean ;
36
+ private readonly onlyAscii : boolean ;
36
37
37
38
constructor ( target : string ,
38
39
dir : string [ ] ,
39
40
exactArtifactPath : string ,
40
41
rssLimitMb : number ,
41
42
timeout : number ,
42
43
regression : boolean ,
44
+ onlyAscii : boolean ,
43
45
versifier : boolean ) {
44
46
this . target = target ;
45
- this . corpus = new Corpus ( dir ) ;
47
+ this . corpus = new Corpus ( dir , onlyAscii ) ;
48
+ this . onlyAscii = onlyAscii ;
46
49
this . versifier = versifier ;
47
50
this . verse = null ;
48
51
this . total_executions = 0 ;
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ function startFuzzer(argv: any) {
10
10
argv . rssLimitMb ,
11
11
argv . timeout ,
12
12
argv . regression ,
13
+ argv . onlyAscii ,
13
14
argv . versifier ) ;
14
15
fuzzer . start ( )
15
16
}
@@ -56,5 +57,10 @@ require('yargs')
56
57
description : 'use versifier algorithm (good for text based protocols)' ,
57
58
default : true ,
58
59
} )
60
+ . option ( 'only-ascii' , {
61
+ type : 'boolean' ,
62
+ description : 'generate only ASCII (isprint+isspace) inputs' ,
63
+ default : false ,
64
+ } )
59
65
. help ( )
60
66
. argv ;
You can’t perform that action at this time.
0 commit comments