Files
json-c/tests
Wleeaf 0389cc85ce json_patch: reject a move past the end of the same array
json_object_array_move_cb() added one to the array length when "from"
and "path" are in the same array, so that the old length counted as a
valid target index. A move is a remove followed by an add (RFC 6902
section 4.4), and the add's index must not be greater than the number
of elements left after the remove. With the extra slot,
json_object_array_insert_idx() was called one past the end and padded
the array with a null:

    doc:   {"foo": [1, 2, 3]}
    patch: [{"op": "move", "from": "/foo/0", "path": "/foo/3"}]

returned 0 with {"foo": [2, 3, null, 1]}. It now fails with EINVAL,
like an add to /foo/3 on a two-element array. Moving to /foo/2 or
/foo/- still puts the element last.
2026-11-09 08:22:21 -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