123456789101112131415161718192021222324252627282930313233 |
- // +build gofuzz
- // fuzzing with https://github.com/dvyukov/go-fuzz
- package mscfb
- import (
- "bytes"
- "io"
- )
- func Fuzz(data []byte) int {
- doc, err := New(bytes.NewReader(data))
- if err != nil {
- if doc != nil {
- panic("doc != nil on error " + err.Error())
- }
- return 0
- }
- buf := &bytes.Buffer{}
- for entry, err := doc.Next(); ; entry, err = doc.Next() {
- if err != nil {
- if err == io.EOF {
- return 1
- }
- if entry != nil {
- panic("entry != nil on error " + err.Error())
- }
- }
- buf.Reset()
- buf.ReadFrom(entry)
- }
- return 1
- }
|