Address code review feedback: .gitignore path, fuzzer docs, trailing whitespace test

Co-authored-by: syoyo <18676+syoyo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-19 00:44:04 +00:00
parent 2c1a8be82d
commit 12affdcc64
3 changed files with 13 additions and 3 deletions

2
.gitignore vendored
View File

@@ -1,5 +1,5 @@
# CMake
build/
/build/
CMakeCache.txt
CMakeFiles
CMakeScripts

View File

@@ -61,7 +61,10 @@ static void fuzz_binary(const uint8_t *data, size_t size) {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (size == 0) return 0;
/* Use the first byte to select the parse path, pass the rest as input. */
/* Use the lowest bit of the first byte to select the parse path.
* The remaining bits are left for the fuzzer engine to explore;
* additional paths (e.g. LoadASCIIFromFile, check_sections flags)
* can be added here in the future using more selector bits. */
uint8_t selector = data[0];
const uint8_t *payload = data + 1;
size_t payload_size = size - 1;

View File

@@ -401,11 +401,18 @@ TEST_CASE("cj-malformed-incomplete-null", "[customjson][malformed]") {
}
TEST_CASE("cj-malformed-extra-data", "[customjson][malformed]") {
// Valid JSON followed by extra data
// Valid JSON followed by extra non-whitespace data
auto doc = JsonConstruct("42 extra");
REQUIRE(doc.is_null());
}
TEST_CASE("cj-trailing-whitespace-ok", "[customjson][parse]") {
// Valid JSON followed by whitespace only should be accepted
auto doc = JsonConstruct("42 \t\n ");
REQUIRE(doc.is_number());
REQUIRE(doc.get<int>() == 42);
}
TEST_CASE("cj-malformed-just-brace", "[customjson][malformed]") {
auto doc = JsonConstruct("{");
REQUIRE(doc.is_null());