github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/fuzz/pgp_key_read/fuzz.go (about)

     1  // Copyright 2015 Keybase, Inc. All rights reserved. Use of
     2  // this source code is governed by the included BSD license.
     3  
     4  //go:build gofuzz
     5  // +build gofuzz
     6  
     7  package libkb
     8  
     9  import "github.com/keybase/client/go/libkb"
    10  
    11  func Fuzz(data []byte) int {
    12  	key, _, err := libkb.ReadOneKeyFromBytes(data)
    13  	if err != nil {
    14  		if key != nil {
    15  			panic("key not nil on error")
    16  		}
    17  		return 0
    18  	}
    19  	return 1
    20  }