Set up fuzzing with go-fuzz

This commit is contained in:
Niklas Fasching 2018-12-20 00:30:58 +01:00
parent 7a8e90f786
commit 8e154c2fd8
3 changed files with 32 additions and 1 deletions

19
org/fuzz.go Normal file
View file

@ -0,0 +1,19 @@
// +build gofuzz
package org
import "bytes"
// Fuzz function to be used by https://github.com/dvyukov/go-fuzz
func Fuzz(data []byte) int {
d := NewDocument().Silent().Parse(bytes.NewReader(data))
_, err := d.Write(NewOrgWriter())
if err != nil {
panic(err)
}
_, err = d.Write(NewHTMLWriter())
if err != nil {
panic(err)
}
return 0
}