Skip to content

Fix removeMember truncating string keys at embedded NULs - #1721

Open
FanWu-ai wants to merge 1 commit into
open-source-parsers:masterfrom
FanWu-ai:fix/remove-member-embedded-nul
Open

FanWu-ai wants to merge 1 commit into
open-source-parsers:masterfrom
FanWu-ai:fix/remove-member-embedded-nul

Conversation

@FanWu-ai

@FanWu-ai FanWu-ai commented Oct 5, 2026

Copy link
Copy Markdown

Problem

The removeMember(const String&) overload documents support for embedded nulls,
but delegates through c_str() to the null-terminated overload. This can remove
the wrong property: if both name and name\0suffix exist, removing the latter
deletes name and leaves the requested property in place.

Change

Delegate to the existing length-aware removeMember(const String&, Value*)
overload, retaining the one-argument overload's existing object/null type check.
No public API or ABI changes are needed.

Tests cover leading, internal and trailing NULs, preservation of prefix keys,
repeated removal of missing keys, null values, empty keys, and wrong-type
assertions. The regression produced 12 failed assertions before the fix.

Validation

  • Full Meson static, shared and coverage suites, including reader/writer and
    JSON checker tests: pass; native unit cases increase from 131 to 133.
  • Full CMake builds and CTest suites under C++11, C++17, C++20 and C++23: pass.
  • Six installed-library cross-standard consumers between C++11/17/23, each
    running the complete unit suite: pass.
  • Amalgamated library with the complete unit suite: pass.
  • clang-format 18.1.8 over the CI file scopes, strict Doxygen 1.18.0 build and
    patch whitespace checks: pass.

Validation was performed on Linux with GCC 14.2. The complete baseline was run
before implementation. Reader/writer runs were serialized because their test
artifacts share the source directory.

The local zizmor SARIF reporting command exits successfully and retains 34
pre-existing findings in the unchanged workflow definitions. Authenticated
online audits and SARIF upload were not run locally; this is not a claim of a
clean security audit.

AI tools assisted implementation and testing, with an independent AI-assisted
source review and native-suite rerun.

@FanWu-ai
FanWu-ai marked this pull request as ready for review October 5, 2026 06:34
@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Fixes string key handling in member removal.

The PR appears safe to merge; no actionable issue was identified.

Summary

The PR makes the one-argument String removal overload use length-aware key removal and adds regression tests for embedded NULs and related edge cases.

  • The changed removal path preserves the full key length.
  • The tests cover prefix preservation, missing keys, null values, empty keys, and invalid value types.

Reviews (1) · Last reviewed commit: "Fix removeMember truncating string keys ..."

This branch has not been deployed

No deployments
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