Skip to content

fuzzing: add a fuzzer for cJSON_Utils - #1118

Open
0xalpharush wants to merge 3 commits into
DaveGamble:masterfrom
0xalpharush:fuzz-utils
Open

0xalpharush wants to merge 3 commits into
DaveGamble:masterfrom
0xalpharush:fuzz-utils

Conversation

@0xalpharush

@0xalpharush 0xalpharush commented Oct 27, 2026 •

Copy link
Copy Markdown

OSS-Fuzz builds only cjson_read_fuzzer, so nothing fuzzes cJSON_Utils.c. This adds cjson_utils_fuzzer. Its input is two NUL-terminated strings. The fuzzer parses both, then runs JSON Pointer lookup, applying the second document as a JSON Patch, generating and applying patches, merge patch, FindPointerFromObjectTo and SortObject. The second string is also used as a JSON Pointer into the first document. The item it selects is passed as the second argument of every function that takes two documents (merge patch, apply patches, generate patches, generate merge patch, find pointer), so the fuzzer also covers a document combined with part of itself, the case of #1060. ossfuzz.sh now builds cJSON_Utils and the new target, and reuses json.dict. OSS-Fuzz runs ossfuzz.sh, so it picks up the new target with no change on its side.

Tested (clang 18, ASan+UBSan, libFuzzer):

🤖 Generated with Claude Code

No fuzzer covered cJSON_Utils. The new target parses two documents and
runs the JSON Pointer, JSON Patch and merge patch functions on them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0xalpharush and others added 2 commits October 27, 2026 06:33
The second string is also used as a JSON pointer into the first document,
and the item it points to is merged into that document, the case of DaveGamble#1060.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Instead of only merging a document with a part of itself, pass the item
the pointer selects as the second argument of every utils function that
takes two documents, and use it as the target of
cJSONUtils_FindPointerFromObjectTo in place of the first child.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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