checkSliceAliasingGate (Gate 7: ALIASING) asserts that the value bytes Get returns appear as a sub-slice of the input data. Per Get's documentation, the returned slice is a "Pointer to original data structure containing key value" — i.e. it ALIASES the input. If the value is not found in data, Get r
(t *testing.T, data []byte, path []string)
| 1131 | // Size-capped: bytes.Index is O(n+m) on average but O(n*m) worst-case. On |
| 1132 | // huge fuzz inputs (deep nesting), this gate would dominate fuzz exec time. |
| 1133 | func checkSliceAliasingGate(t *testing.T, data []byte, path []string) { |
| 1134 | t.Helper() |
| 1135 | if len(data) > fuzzGateSizeCap { |
| 1136 | return |
| 1137 | } |
| 1138 | val, dt, _, err := Get(data, path...) |
| 1139 | if err != nil || len(val) == 0 { |
| 1140 | return |
| 1141 | } |
| 1142 | // NotExist/Unknown are sentinels; no aliasing contract applies. |
| 1143 | if dt == NotExist || dt == Unknown { |
| 1144 | return |
| 1145 | } |
| 1146 | if bytes.Index(data, val) == -1 { |
| 1147 | t.Errorf("Get returned value not aliased to input data "+ |
| 1148 | "(ALIASING violation): val=%q dt=%v data=%q path=%v", |
| 1149 | val, dt, data, path) |
| 1150 | } |
| 1151 | } |
| 1152 | |
| 1153 | // checkParseStringGate (Gate 8: PARSESTRING) extracts a String-typed value |
| 1154 | // via Get and calls ParseString on the raw escaped content. Closes the API- |
no test coverage detected