Files
json-c/tests
EminY cdd8db0530 json_patch: treat an empty "from" as a parent of any "path"
Since the token-boundary check for the parent/child test (1b504e2), an
empty "from" (the root) only counts as a prefix of "path" when "path"
starts with '/'. With an invalid "path" like "a", a move from "" went
on to remove the root: __json_patch_apply_remove() dropped a reference
to the document, the following set failed on the bad path, and the
error path dropped the last reference, so *base was freed while the
caller still owned it (use-after-free / double free in
json_object_put()).

The root is a parent of every other location, so an empty "from" now
always takes the parent/child branch: a no-op for "path": "" and
EINVAL otherwise. This also restores the invariant the comment below
relies on, that json_pointer can't find the root here.

Added move and copy cases to json_patch_tests.json and regenerated
test_json_patch.expected.
2026-11-08 21:27:08 -05:00
..
2022-08-13 20:47:20 -07:00
2022-08-13 20:47:20 -07:00
2020-03-31 19:12:45 +08:00
2022-08-13 15:47:40 +03:00
2020-03-31 19:12:45 +08:00
2026-09-07 09:58:09 +08:00