MCPcopy Create free account
hub / github.com/buger/jsonparser / safeCall

Function safeCall

property_test.go:993–1002  ·  view source on GitHub ↗

safeCall invokes a fuzz harness, recovering from any panic and returning the harness result or -1 on panic.

(fn func([]byte) int, in []byte)

Source from the content-addressed store, hash-verified

991// safeCall invokes a fuzz harness, recovering from any panic and returning
992// the harness result or -1 on panic.
993func safeCall(fn func([]byte) int, in []byte) int {
994 var v int
995 defer func() {
996 if r := recover(); r != nil {
997 v = -1
998 }
999 }()
1000 v = fn(in)
1001 return v
1002}
1003
1004// ---------------------------------------------------------------------------
1005// Property: every public surface is panic-free on random bytes (universal)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected