truncateAtValueBoundary cuts the document right after a ':' (before the value starts). This is the OSS-Fuzz 4649128545288192 / sentinel_value_boundary class: the parser must not dereference past the cut when looking for the value token.
(r *rand.Rand, data []byte)
| 569 | // sentinel_value_boundary class: the parser must not dereference past the |
| 570 | // cut when looking for the value token. |
| 571 | func truncateAtValueBoundary(r *rand.Rand, data []byte) []byte { |
| 572 | pos := findStructuralBytes(data, ':') |
| 573 | if len(pos) == 0 { |
| 574 | return data |
| 575 | } |
| 576 | cut := pos[r.Intn(len(pos))] + 1 |
| 577 | if cut > len(data) { |
| 578 | cut = len(data) |
| 579 | } |
| 580 | out := make([]byte, cut) |
| 581 | copy(out, data[:cut]) |
| 582 | return out |
| 583 | } |
| 584 | |
| 585 | // truncateMidKey cuts inside a string key. The cut is placed between the |
| 586 | // opening '"' of a key and its closing '"'. This is the truncated_mid_key |
nothing calls this directly
no test coverage detected