Repository navigation
Conversation
The C API returns multi and stream results as NUL-terminated strings, so a NUL inside a file name, a --string file content or a stream document was read as a separator and produced extra entries. Raise a runtime error instead, since the output format cannot represent it.
This branch has not been deployed
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.
Multi (
-m) and stream (-y) results come back from the C API as NUL-terminated strings, whichwrite_multi_output_filesand libjsonnet++'sparseMultiOutputsplit on NUL, butmanifestMultiandmanifestStreamnever rejected U+0000, so with--stringa NUL inside a value forges extra entries. For example{ "report.txt": importstr "upload.txt" }, where upload.txt containsbody\0../escaped.sh\0echo pwned, makesjsonnet -S -m outwriteout/../escaped.sh, a file name the program never produced, andjsonnet -S -y -e '["a\u0000b"]'emits two documents. File names, string-mode contents and stream documents containing NUL now raise a runtime error, since the format cannot represent them; JSON-mode output is unchanged because NUL is already escaped as\u0000there, so only output that was previously corrupted is affected. Added test_cmd cases multi5, multi6 and yaml4, which fail before the change and pass after it, andmake testpasses.