Repository navigation
Reject NUL-truncated Validator schemas and documents - #250
Merged
lelit merged 2 commits intoOct 31, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Validatorstill accepts a valid JSON prefix followed by an embedded NUL and trailing bytes, both when constructing a schema and when validating a document. This follows up the same parsing completeness problem fixed forloads(),load(), andDecoderin #245. The documentedJSONDecodeErrorcontract applies to both Validator inputs too.Both paths now retain the UTF-8 byte length, parse through a
StringStream, and reject unconsumed input using the existingInvalid JSONerror. Escaped NULs and valid trailing JSON whitespace continue to work, and schema mismatches still raiseValidationError.Validation:
_staticdirectory warning. A separate commit makes the native-float example portable: it still requires a float and permits only one ULP of rounding difference. The exact-repr example failed identically with a separately rebuilt unchanged baseline; no numeric implementation changed.python -m mypy.stubtest rapidjsonandgit diff --check: passed.AI assistance: Codex prepared the patch, tests, and description. A separate Codex agent reviewed the final diff and independently ran 67 Validator tests (plus 2 expected failures), all 277 doctests, and the installed-wheel consumer. This is agent review, not human review. Debug Python, sanitizers, other platforms, and hosted CI have not been verified locally.