Skip to content

tests: regression test for object-patch-subtree-of-array merge_patch UAF (companion to #1109) - #1119

Open
w4ffl35 wants to merge 1 commit into
DaveGamble:masterfrom
Capsize-Games:add-1109-regression-test
Open

w4ffl35 wants to merge 1 commit into
DaveGamble:masterfrom
Capsize-Games:add-1109-regression-test

Conversation

@w4ffl35

@w4ffl35 w4ffl35 commented Oct 27, 2026

Copy link
Copy Markdown

Companion regression test for #1109, as offered on the PR and accepted by @Oculytic.

What it covers: merging an object patch that is a subtree of its target (here an element of an array target [1, 2, {"a": 1}]). Without the #1109 fix, merge_patch deletes the target (freeing the patch with it) and then reads the freed patch back — heap-use-after-free.

Red/green evidence (fresh clone at 6d9f244, tests/old_utils_tests.c only file changed):

Note: this test fails until #1109 merges — please land #1109 first (or together). Written in the file's existing Unity style; no production code touched.

AI disclosure: drafted with AI assistance (Muse), validated by local red/green runs; independent review welcome.

…UAF (PR DaveGamble#1109)

Merging a patch that is a subtree of its target freed the patch
along with the target and then read it back (heap-use-after-free).
PR DaveGamble#1109 fixes the non-object-target path; this test pins the exact
variant (object patch that is an element of an array target).

Red/green verified locally: segfaults on master at 6d9f244
(plain and ASan+UBSan builds), passes with DaveGamble#1109 applied (7/7 green).
Intended to land after DaveGamble#1109; until then it fails as expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant