github.com/fraugster/parquet-go@v0.12.0/reader_fuzz.go (about)

     1  //go:build gofuzz
     2  // +build gofuzz
     3  
     4  package goparquet
     5  
     6  import (
     7  	"bytes"
     8  	"errors"
     9  	"io"
    10  )
    11  
    12  func FuzzFileReader(data []byte) int {
    13  	r, err := NewFileReader(bytes.NewReader(data))
    14  	if err != nil {
    15  		return 0
    16  	}
    17  
    18  	for {
    19  		_, err := r.NextRow()
    20  		if err != nil {
    21  			if errors.Is(err, io.EOF) {
    22  				break
    23  			}
    24  			return 0
    25  		}
    26  		for _, col := range r.Columns() {
    27  			_ = col.Element()
    28  		}
    29  	}
    30  
    31  	return 1
    32  }