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

Function genKeyPath

json_fuzz_test.go:935–942  ·  view source on GitHub ↗

============================================================================= Adversarial key-path generator ============================================================================= genKeyPath returns a variadic key path that targets known-dangerous dereference sites: empty strings (the SYS-REQ

(r *rand.Rand)

Source from the content-addressed store, hash-verified

933// syntax (the SYS-REQ-110 Set array-index-beyond-length hazard), out-of-range
934// indices, and deeply-nested paths.
935func genKeyPath(r *rand.Rand) []string {
936 n := 1 + r.Intn(4) // 1..4 components
937 path := make([]string, n)
938 for i := range path {
939 path[i] = genPathComponent(r)
940 }
941 return path
942}
943
944// genPathComponent returns a single adversarial path component.
945func genPathComponent(r *rand.Rand) string {

Callers 2

injectPathHazardFunction · 0.85
TestJSONFuzzCorpusSanityFunction · 0.85

Calls 1

genPathComponentFunction · 0.85

Tested by

no test coverage detected