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

Function safeCall

property_test.go:880–889  ·  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

878// safeCall invokes a fuzz harness, recovering from any panic and returning
879// the harness result or -1 on panic.
880func safeCall(fn func([]byte) int, in []byte) int {
881 var v int
882 defer func() {
883 if r := recover(); r != nil {
884 v = -1
885 }
886 }()
887 v = fn(in)
888 return v
889}
890
891// ---------------------------------------------------------------------------
892// Property: every public surface is panic-free on random bytes (universal)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected