checkLength ensures that an encoded value is not too long to fit into the JEntry header. This should never come up, since it would require a ~250MB JSON value, but check it just to be safe.
(length int)
| 37 | // JEntry header. This should never come up, since it would require a ~250MB |
| 38 | // JSON value, but check it just to be safe. |
| 39 | func checkLength(length int) error { |
| 40 | if length > maxByteLength { |
| 41 | return errors.AssertionFailedf("JSON value too large: %d bytes", errors.Safe(length)) |
| 42 | } |
| 43 | return nil |
| 44 | } |
| 45 | |
| 46 | // Note: the encoding of each of null, true, and false are the encoding of length 0. |
| 47 | // Their values are purely dictated by their type. |