fix: off-by-one in decode_pointer_inplace for ~1 escape sequence#998
Open
ctonneslan wants to merge 1 commit intoDaveGamble:masterfrom
Open
fix: off-by-one in decode_pointer_inplace for ~1 escape sequence#998ctonneslan wants to merge 1 commit intoDaveGamble:masterfrom
ctonneslan wants to merge 1 commit intoDaveGamble:masterfrom
Conversation
decode_pointer_inplace writes the decoded '/' for '~1' to decoded_string[1] instead of decoded_string[0], corrupting JSON Pointer paths that contain forward slashes. The '~0' case correctly writes to decoded_string[0]. Fixes DaveGamble#977
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.
Summary
Fixes an off-by-one bug in
decode_pointer_inplace()where the~1escape sequence writes the decoded/to the wrong position, corrupting JSON Pointer paths during patch application.Bug
This causes JSON Pointer paths containing
~1(encoded/) to be decoded incorrectly. For example, a patch targeting"a/b"(encoded as"a~1b") would corrupt the key to"a~/"instead of"a/b".Fix
Consistent with the
~0case on line 373.Fixes #977