mirror of
https://github.com/nlohmann/json.git
synced 2026-09-30 14:05:18 +00:00
An image is a document stored so that loading it needs no parsing: a 64-byte header, the nodes, the text, and the decoded strings (little-endian; version 1). - save() writes an edited document in its current state, in document order (floats that are not finite become null, as in dump()); the same document always gives the same bytes - load(pointer, size) and load(const vector&) borrow the image; load(vector&&) keeps it without a copy. The nodes are copied (aligned, and editable); the hash indexes of large objects are rebuilt. - image_check::full checks everything the parser guarantees (structure, bounds, UTF-8, strings of the source, number tokens and their values); bounds checks structure and bounds, so that reading and serializing stay safe; none trusts the image. A malformed image or a failed check throws the new parse_error.116; saving a discarded document (or images on a big-endian target) throws the new type_error.320; images of 4 GiB or more out_of_range.416. As images checked for bounds only can hold any bytes, the general float conversion now checks the token's grammar (and locates the point and the exponent itself), the exponent loop of the layout conversion takes digits as unsigned, and the serializer validates each non-ASCII sequence it decodes, throwing what basic_json::dump() throws for invalid UTF-8. Parsed and edited documents are not affected. The idea of images comes from zero-copy formats such as FlatBuffers and YaFF, the check from FlatBuffers' Verifier; no code is taken from them. Tests: round trips with every check (small documents, test files, large objects, edited documents with every kind of edit), ownership, all errors, one corruption per rejection branch of the check, and 12,000 seeded random corruptions, which must be rejected or read safely. The fuzzer json_view_image_fuzzer uses each input as an image and as a JSON text. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
78 lines
1.9 KiB
YAML
78 lines
1.9 KiB
YAML
version: 1
|
|
|
|
labels:
|
|
- label: "documentation"
|
|
files:
|
|
- "README.md"
|
|
|
|
- label: "documentation"
|
|
files:
|
|
- "docs/.*"
|
|
|
|
- label: "tests"
|
|
files:
|
|
- "tests/.*"
|
|
|
|
- label: "CMake"
|
|
files:
|
|
- ".*CMakeLists.txt"
|
|
|
|
- label: "CMake"
|
|
files:
|
|
- "cmake/.*"
|
|
|
|
- label: "CI"
|
|
files:
|
|
- ".github/workflows/.*"
|
|
|
|
- label: "CI"
|
|
files:
|
|
- ".github/external_ci/.*"
|
|
|
|
- label: "CI"
|
|
files:
|
|
- ".github/(dependabot|labeler)\\.yml"
|
|
|
|
- label: "aspect: binary formats"
|
|
files:
|
|
- "include/nlohmann/detail/input/binary_reader\\.hpp"
|
|
- "include/nlohmann/detail/output/binary_writer\\.hpp"
|
|
- "tests/src/unit-(bson|cbor|msgpack|ubjson|bjdata|bon8|binary_formats)"
|
|
- "tests/src/fuzzer-parse_(bson|cbor|msgpack|ubjson|bjdata|bon8)"
|
|
- "docs/mkdocs/docs/features/binary_formats/"
|
|
- "docs/mkdocs/docs/(api/basic_json|examples)/(to|from)_(bson|cbor|msgpack|ubjson|bjdata|bon8)"
|
|
|
|
- label: "aspect: binary formats"
|
|
title: "(?i)(bson|cbor|msgpack|messagepack|ubjson|bjdata|bon8|binary format)"
|
|
|
|
- label: "aspect: json_view"
|
|
files:
|
|
- "include/nlohmann/json_view\\.hpp"
|
|
- "include/nlohmann/detail/view/.*"
|
|
- "single_include/nlohmann/json_view\\.hpp"
|
|
- "tests/src/unit-json_view.*"
|
|
- "tests/src/fuzzer-(parse_json_view|json_view_image)\\.cpp"
|
|
- "tests/benchmarks/json_view/.*"
|
|
- "tools/amalgamate/config_json_view\\.json"
|
|
- "docs/mkdocs/docs/features/json_view\\.md"
|
|
- "docs/mkdocs/docs/api/basic_json_(document|view)/.*"
|
|
- "docs/mkdocs/docs/api/(ordered_)?json_(editable_)?(document|view)\\.md"
|
|
- "docs/mkdocs/docs/examples/(basic_json_(document|view)__|(ordered_)?json_(editable_)?(document|view)).*"
|
|
- "tests/benchmarks/src/benchmarks_view\\.cpp"
|
|
|
|
- label: "aspect: json_view"
|
|
title: "(?i)(json_view|json_document|zero-copy)"
|
|
|
|
- label: "python"
|
|
files:
|
|
- "\\.py$"
|
|
- "requirements[^/]*\\.txt$"
|
|
|
|
- label: "S"
|
|
size-below: 10
|
|
- label: "M"
|
|
size-above: 9
|
|
size-below: 100
|
|
- label: "L"
|
|
size-above: 100
|