0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/lib/std/json
nash1111 22aa2bd1e7 std.json: honor max_value_len for sentinel strings (#30782)
Fixes `std.json` so `ParseOptions.max_value_len` is honored when parsing sentinel-terminated strings that require allocation/copying.

Previously, the sentinel string path used `allocNextIntoArrayList`, which did not use the caller-provided `max_value_len`. This meant sentinel-terminated string parsing did not consistently follow the same allocation limit behavior as other allocating string paths.

`max_value_len` is an allocation/copy limit, not a general limit on the length of returned values. Values that can be returned as references to the input buffer, or parsed without intermediate allocation, are not limited by it.

Fixes #30579

Verified with:

```sh
zig test lib/std/std.zig --zig-lib-dir lib --test-filter max_value_len
```

Co-authored-by: nash1111 <nash1111@users.noreply.github.com>
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30782
Reviewed-by: Ryan Liptak <squeek502@noreply.codeberg.org>
History 2026-06-03 14:31:35 +02:00
..
dynamic.zig std: remove managed array hash map variants 2026-04-10 17:39:45 +02:00
dynamic_test.zig std: remove managed array hash map variants 2026-04-10 17:39:45 +02:00
hashmap.zig Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
hashmap_test.zig std.json: update to new I/O API 2025-07-19 16:05:01 -07:00
JSONTestSuite_test.zig remove uses of array multiplication 2026-04-30 08:57:51 +01:00
Scanner.zig Prefer <err> => |e| return e over <err> => return <err> 2026-04-20 18:03:14 -07:00
scanner_test.zig remove uses of array multiplication 2026-04-30 08:57:51 +01:00
static.zig std.json: honor max_value_len for sentinel strings (#30782) 2026-06-03 14:31:35 +02:00
static_test.zig std.json: honor max_value_len for sentinel strings (#30782) 2026-06-03 14:31:35 +02:00
Stringify.zig all: update to use new std.lang.Type definitions 2026-05-27 10:03:51 +01:00
test.zig std.json: update to new I/O API 2025-07-19 16:05:01 -07:00