--------------------------------------------------------------------------- Property: every public surface is panic-free on random bytes (universal) --------------------------------------------------------------------------- This is the universal OSS-Fuzz invariant asserted across the entire parser
(t *testing.T)
| 1012 | // reqproof:proptest parser.Get |
| 1013 | // Verifies: SYS-REQ-035 [property] |
| 1014 | func TestPropertyNoPanicOnArbitraryBytes(t *testing.T) { |
| 1015 | r := newRNG(jsonSeed + 15) |
| 1016 | const iterations = 3000 |
| 1017 | for i := 0; i < iterations; i++ { |
| 1018 | raw := randomBytes(r, 64) |
| 1019 | keys := []string{randKey(r)} |
| 1020 | _ = recoverNoPanic(func() { _, _, _, _ = Get(raw, keys...) }) |
| 1021 | _ = recoverNoPanic(func() { _, _, _, _ = Get(raw) }) |
| 1022 | _ = recoverNoPanic(func() { _, _ = GetString(raw, keys...) }) |
| 1023 | _ = recoverNoPanic(func() { _, _ = GetInt(raw, keys...) }) |
| 1024 | _ = recoverNoPanic(func() { _, _ = GetFloat(raw, keys...) }) |
| 1025 | _ = recoverNoPanic(func() { _, _ = GetBoolean(raw, keys...) }) |
| 1026 | _ = recoverNoPanic(func() { _, _ = GetUnsafeString(raw, keys...) }) |
| 1027 | _ = recoverNoPanic(func() { |
| 1028 | ArrayEach(raw, func(value []byte, dataType ValueType, offset int, err error) {}) |
| 1029 | }) |
| 1030 | _ = recoverNoPanic(func() { |
| 1031 | ObjectEach(raw, func(key, value []byte, dataType ValueType, offset int) error { return nil }) |
| 1032 | }) |
| 1033 | _ = recoverNoPanic(func() { |
| 1034 | EachKey(raw, func(idx int, value []byte, vt ValueType, err error) {}, keys) |
| 1035 | }) |
| 1036 | _ = recoverNoPanic(func() { |
| 1037 | assertInputUnchanged(t, raw, func() { |
| 1038 | _ = Delete(raw, keys...) |
| 1039 | }) |
| 1040 | }) |
| 1041 | _ = recoverNoPanic(func() { |
| 1042 | assertInputUnchanged(t, raw, func() { |
| 1043 | _, _ = Set(raw, []byte(`"x"`), keys...) |
| 1044 | }) |
| 1045 | }) |
| 1046 | _ = recoverNoPanic(func() { _, _ = ParseInt(raw) }) |
| 1047 | _ = recoverNoPanic(func() { _, _ = ParseFloat(raw) }) |
| 1048 | _ = recoverNoPanic(func() { _, _ = ParseBoolean(raw) }) |
| 1049 | _ = recoverNoPanic(func() { _, _ = ParseString(raw) }) |
| 1050 | } |
| 1051 | } |
| 1052 | |
| 1053 | // --------------------------------------------------------------------------- |
| 1054 | // Property: thread-safety — concurrent reads are panic-free and deterministic |
nothing calls this directly
no test coverage detected