-
Notifications
You must be signed in to change notification settings - Fork 245
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
Showing
19 changed files
with
190 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
.PHONY: test | ||
.PHONY: test fuzz | ||
|
||
test: | ||
go test -coverprofile=profile.out -coverpkg=github.com/yuin/goldmark,github.com/yuin/goldmark/ast,github.com/yuin/goldmark/extension,github.com/yuin/goldmark/extension/ast,github.com/yuin/goldmark/parser,github.com/yuin/goldmark/renderer,github.com/yuin/goldmark/renderer/html,github.com/yuin/goldmark/text,github.com/yuin/goldmark/util ./... | ||
|
||
cov: test | ||
go tool cover -html=profile.out | ||
|
||
fuzz: | ||
which go-fuzz 2>&1 > /dev/null || (GO111MODULE=off go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build; GO111MODULE=off go get -d github.com/dvyukov/go-fuzz-corpus; true) | ||
cd ./fuzz && go-fuzz-build | ||
rm -rf ./fuzz/corpus | ||
rm -rf ./fuzz/crashers | ||
rm -rf ./fuzz/suppressions | ||
rm -f ./fuzz/fuzz-fuzz.zip | ||
cd ./fuzz && go-fuzz |
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
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,28 @@ | ||
package fuzz | ||
|
||
import ( | ||
"bytes" | ||
"github.com/yuin/goldmark" | ||
"github.com/yuin/goldmark/extension" | ||
"github.com/yuin/goldmark/renderer/html" | ||
) | ||
|
||
func Fuzz(data []byte) int { | ||
markdown := goldmark.New( | ||
goldmark.WithRendererOptions( | ||
html.WithUnsafe(), | ||
), | ||
goldmark.WithExtensions( | ||
extension.DefinitionList, | ||
extension.Footnote, | ||
extension.GFM, | ||
extension.Typographer, | ||
), | ||
) | ||
var b bytes.Buffer | ||
if err := markdown.Convert(data, &b); err != nil { | ||
return 0 | ||
} | ||
|
||
return 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,41 @@ | ||
package fuzz | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"io/ioutil" | ||
"testing" | ||
|
||
"github.com/yuin/goldmark" | ||
"github.com/yuin/goldmark/extension" | ||
"github.com/yuin/goldmark/renderer/html" | ||
"github.com/yuin/goldmark/util" | ||
) | ||
|
||
var _ = fmt.Printf | ||
|
||
func TestFuzz(t *testing.T) { | ||
crasher := "6dff3d03167cb144d4e2891edac76ee740a77bc7" | ||
data, err := ioutil.ReadFile("crashers/" + crasher) | ||
if err != nil { | ||
return | ||
} | ||
fmt.Printf("%s\n", util.VisualizeSpaces(data)) | ||
fmt.Println("||||||||||||||||||||||") | ||
markdown := goldmark.New( | ||
goldmark.WithRendererOptions( | ||
html.WithUnsafe(), | ||
), | ||
goldmark.WithExtensions( | ||
extension.DefinitionList, | ||
extension.Footnote, | ||
extension.GFM, | ||
extension.Typographer, | ||
), | ||
) | ||
var b bytes.Buffer | ||
if err := markdown.Convert(data, &b); err != nil { | ||
panic(err) | ||
} | ||
fmt.Println(b.String()) | ||
} |
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
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
Oops, something went wrong.