github.com/coyove/sdss@v0.0.0-20231129015646-c2ec58cca6a2/contrib/roaring/serializationfuzz.go (about)

     1  //go:build gofuzz
     2  // +build gofuzz
     3  
     4  package roaring
     5  
     6  import "bytes"
     7  
     8  func FuzzSerializationStream(data []byte) int {
     9  	newrb := NewBitmap()
    10  	if _, err := newrb.ReadFrom(bytes.NewReader(data)); err != nil {
    11  		return 0
    12  	}
    13  	return 1
    14  }
    15  
    16  func FuzzSerializationBuffer(data []byte) int {
    17  	newrb := NewBitmap()
    18  	if _, err := newrb.FromBuffer(data); err != nil {
    19  		return 0
    20  	}
    21  	return 1
    22  }